first program on java
public class First
{
public static void main(String[] args)
{
System.out.println("Hello java");
}
}
letus expand this
1. public class First
public: it is access specifier which tells us it is public and can be used anywhere inside or outside the package.
class: it is actually keyword and class must start with this keyword
First: class name or simply an identifier which is used to name the class
Note: cass name should start with Capitel Letter.
note: program has only one public class rest all are just deault class
2. public static void main(String[] args)
public: it is access specifier which tells us it is public and can be used anywhere inside or outside the package.
static: which is used to allocate memory at compile time and also it represents whole class not as simple object.
void: return type and void means return type is nothing.
main: it is simply class name
string [] args: array of string type
note: every program has just one main method other are just to shape the program and our execuition starts form main method.
3. System.out.println("Hello java")
System: is just a class.it is decleared as final.
out: is an instance of the System class and is of type PrintStream
Println or print : is actally a method of PrintStream Class which is used to print thing that we are in need.
note: our class has as many as these types of print messeges.







0 comments:
Post a Comment