Start Java Program

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.

# main() is different from Main().
# System and String are not system and string, S much be capital.

List Code:-
Java codes

Next Code:-
Run Java Program

Java Programs:-
List of Java Programs


Add your comments here

Back to Top