Java Syntax

Syntax of Java

public class ClassName

{

// Access_Specifier MethodName

public void methodName()

{

// Statements

}

}

class MainClassName

{

public static void main(String args[])

{

ClassName objectName = new ClassName(); objectName.methodName();

}

}

Java Example

Simple Example of java

public class myprogram

{

public static void main(String[] args)

{

System.out.println(“This is simple java program by basicofy.com”);

}

}

Output: This is simple java program by basicofy.com

Leave a Reply

Your email address will not be published. Required fields are marked *