First Java Program



                         

                                              Hello World Program

         Let's write a program called "Hello World".

                   Here are some basics steps to write a hello world program.

                   1.  Step - Open your notepad or any code editor 

                    which you want to use.

               2.  Step -  Create a class 

                    for example -      public class subh{ }

                    here your class name is subh.          

              

                    3. Step -  Write a main method of java that is pre-defined.

              example -    public static void main(String [] args) 

               after that use curly braces  { }.

              4. Step - Print the Hello world the method of printing text

                  is -

                 System.out.println("Hello World")

                   after writing this put semicolon ( ; ) .

                  and then close with curly braces.


              Let's see the whole code 

              


     If you are running your code in offline compilers like vs code,

     sublime, notepad then extension (Mean file name) is like your 

    class name and dot . java 

    for example -  if your class name is Main then the extension will        be 

    like this Main.java

The output will be  -   

     


                 


1 comment: