class mypro {
public static void main(String args[]){
System.out.println("welcome to Aboutcodes");
}
}
All java program are start with class. mypro is name of class. The body of class will be between {} braces.
All java application begin execution by calling main().
public is allows the programmer to control the visibility of class members. when class member is defined by public than that member can be accessed by code outside the class.
main() must be declared as public, since it must be called by code outside of its class when program is stated.
static allow main() to be called without having to instantiate a perticular instance of the class. this important Because main() is called by the java virtual machine before any objects are made.
void means no return value. here void tells the compiler that main() does not return a value.
There must be a parameter in main(). if there are no parameter, you still need to include the empty parentheses.
String args[] declares a parameter named args, which is an array of instances of the class String. Objects of type String store character strings. In this case, arg receives any command line arguments present when the program is executed.
println is used to display welcome to aboutcodes.
Note:-
# main() is different from Main().
# System and String are not system and string, S much be capital.
Thanks for the information.
ReplyDeletePlease click on the link below.
Certified Ethical Hacking Courses in bangalore
Nice post.. thank you sharing this information
ReplyDeletejava training in Marathahalli
spring training in Marathahalli
java training institute in Marathahalli
spring and hibernate training in Marathahalli
Nice post
ReplyDeletejava training in Bangalore
spring training in Bangalore
java training institute in Bangalore
spring and hibernate training in Bangalore