java tutorial - Language Syntax for Beginners - java programming - learn java - java basics - java for beginners

Java syntax
public class Kaashiv {

	public static void main(String[] args) {
          System.out.println(" Kaashiv Infotech");
  • Every line of code that runs in Java must be inside a class. In our example, we named the class Kaashiv. A class should always start with an uppercase first letter.

Note: Java is case-sensitive: "Kaashiv" and "kaashiv" has different meaning.

  • The name of the java file must match the class name. When saving the file, save it using the class name and add ".java" to the end of the filename.

The main Method

The main() method is a mandatory method which is required in every Java program.

public static void main(String[] args)
  • Any code which needs to be executed should be written inside the main method.
  • Every Java program has a class name which must match the filename, and that every program must contain the main() method.


  • Inside the main() method, we can use the println() method to print a line of text to the screen:
System.out.println(" Kaashiv Infotech");


Kaashiv Infotech

Related Searches to Language Syntax for Beginners