• A.razaq

T-3 writing your first java program

Updated: Jan 24

lets begin making our first hello world! java program

first lets get familiar with the eclipse and start by launching your eclipse




this is what your eclipse should look like , begin by clicking on " create a java project"


write your project name and click finish

then


under your project you made , right click then choose new from the menu then click on class

on this box


write your class name and dont forget class name cannot have a space in it or start with a symbol or number

and make sure to click and select | public static void main ( String[]args) | option

then click on finish.

this window below will appear and you should be ready but first lets remember again the parts one by one .


as we explained before

  1. class name is ( firstprogram ) and followed by a left brace {

  2. then our ( method ) inside also begins with a left brace {

  3. then in the green our code or instructions is written here

  4. after that the method is closed with a right brace }

  5. then the classes is ended with the right brace }

so a java program is like this project>class>methods>Statements ( codes)

----------------------------------------------------------------------------------

now lets make our first java program that displays to the user the message " hello world!"



System.out.println("Hello World!"); 

**important note**

we must write our message or text that we want to display between the double quotation marks " " java considers anything inside the " " double quotation marks as String value

also another ***important note ***


// slash symbols are for comments and it does not execute in your program

and it will be displayed in the green color as a comment or a note , not an actual part of the program function .

it will look like this above

System.out - is a stream output used to output a method .

println - is a method that displays text.


now lets run our program and test it.

click on the green icon to run your program


now our program has been successfully run so it preformed it desired function which is displaying to the user the message " hello world !"

7 views0 comments

Recent Posts

See All