Java Basic Syntax

A basic Java program can be broken down into several constructs and elements. Typically, it can be characterized as a collection of objects, which communicate with each other by calling each other’s routines. The basic definitions of objects and classes are given below:

Class Names

  • For all class names, the first letter ought to be in Upper Case.
  • On the off chance that few words are utilized to structure a name of the class, every internal word’s first letter ought to be in Upper Case. For example, a standard class name is as follows:
class E3DocsApp{}


Case Sensitivity

  • Java is case sensitive, which implies that the identifier E3Docs and e3docs would have distinctive importance in Java.

Method Names

  • All system names ought to begin with a Lower Case letter. In the event that few words are utilized to structure the name of the method, then every internal word’s first letter ought to be in Upper Case. An example of this convention is follows:
public void e3docsTutorials();//valid syntax
public void E3docsTutorials();//valid syntax, but discouraged


Filename

  • The name of the system record ought to precisely match the class name. At the point when you are saving the file, you ought to save it utilizing the class name. Remember Java is case touchy and affix “.java” to the end of the name. If the document name and the class name don’t match your system won’t assemble. Consider the example of a class name E3docs. In this case, you must name the file as e3docs.java.

public static void main(string args[])

  • Java system handling begins from the main() function, which is a required piece of each Java program.