“HAPPINESS SHOULD BE A FUNCTION WITHOUT ANY PARAMETERS”

LEARN JAVA WITH FUN | LECTURE 1 FIRST BASIC PROGRAM.

LEARN JAVA WITH FUN



FIRST PROGRAM:

public class HelloWorld
{
   public static void maini(String [] args)
{
   System.out.println("Hello World");
}
}// do not put semicolon here
Output: Hello World

Detail:
  • At the end of class we don't put semicolon.
  • We can give access specifier before class as in this program we have gave public .
  • We have only two option to select access specifier in outside class (public) and (-) default i.e no name.
  • Before every variable and function name we need to write access specifier (4 access specifiers). 
  • You can notice that in class name we have use camel case notation i.e if in one name two or more word comes we have to start with Capital letter (HelloWorld).
  •  We can call main function without object so we have used static.
  • In  given program the words starting with capital letter is  Predefined Class.
  • System.out.println -> System is a class name, if after class name there is dot(".") this indicates we are going to call static member(variable/function) of class (out) We can refer out as a object. 

FOR NEXT PAGE CLICK HERE:   >>>Lecture 2<<<

No comments:

Post a comment

If you have any problems related to solutions or any concept please let me know.