An Introduction To JAVA Programming Language
An Introduction To JAVA Programming Language
The comments can be used to The Class SampleExercise1 is the name of the Java class. Note
Comment that the file must be named to class name with .java
provide information or explanation definition extension.
about the variable, method, class or The second line of the program consists of the left
any statement. It can also be used to brace, which is matched with the second right brace
(the very last brace). These braces together mark the
hide program code for specific time. beginning and end of (the body of) the class
SampleExercise1.
In Java, every application must contain a
main method whose signature is: System.out.println(“Welcome”);
public static void main(String[] args)
The main
Method Java program processing starts from
the main() method which is a It prints the characters between
mandatory part of every Java quotes to the console.
program.
The JVM starts running any program by
executing this method first.
Keep in mind the following points: Method Names − All method names
Case Sensitivity − Java is case sensitive, which means should start with a Lower Case letter. If
identifier Hello and hello would have different several words are used to form the
meaning in Java. name of the method, then each inner
Class Names − For all class names the first letter word's first letter should be in Upper
Basic should be in Upper Case. If several words are used to Basic Case.
form a name of the class, each inner word's first letter
Syntax should be in Upper Case. Syntax Example: public void myMethodName()
Class names always start with an uppercase letter and Program File Name − Name of the
follow PascalCase program file should exactly match the
Example: class MyFirstJavaClass class name.