Docsity

hello world program in java, Slides of Java Programming

Partial preview of the text

Download hello world program in java and more Slides Java Programming in PDF only on Docsity!

Java Fundamentals

Course

Module 2

What is a computer

program?

What is a computer program?

โ— (^) A computer program is a list of instructions that tells a computer what to do. โ— (^) Everything a computer does is done by using a computer program. โ— (^) A computer program is written in a programming language like C, C++, Java, etc.

Building our first program

โ— (^) We need a way to display something on the screen. Right? โ— (^) The command used to print some text on the screen is: โ— (^) System.out.print โ— (^) Note that Java is a case sensitive language, meaning that uppercase letters and lowercase letters are different for it. โ— (^) So, capital โ€˜Sโ€™ must be capital or else the computer will not be able to understand the command.

โ— (^) Now, you must be wondering, how do we tell the computer to print some specific text on the screen? โ— (^) So, to achieve this, you need open-close curved brackets just after the command, and put your text inside them โ— (^) Something like this: โ— (^) System.out.print(Hello World)

โ— (^) In Java, we put the semicolon after every command. โ— (^) Just like we use the full stop after every statement in English, we use the semicolon to end every command in Java. โ— (^) So the final command will look something like this: โ— (^) System.out.print("Hello World"); โ— (^) put the semicolon after every command. โ— (^) Now RUN the program to get output.

Thank you. Please feel free to ask any

questions. ๐Ÿ˜„