Right click on My Computer Icon --> Properties --> Advance --> Environment variables -->(user variables) --> new --> Variable name: Path
Variable value: c:\java\bin
Points to be remember before writing java program:
1. The code written in java must be with in a class only.
2. Java is a case sensitive programming language, so be careful for small and capital letters.
3. While saving a program, the program name should be same as the base class name followed by the java extension.
4. Java program processing starts from the main() method which is a mandatory part of every Java program.
5. Return type of main is always void.
6. Class Name – For naming a class, the first letter should be in Upper Case. If several words are used to form a name of the class, each inner word's first letter should be in Upper Case. Example: class MyFirstJavaClass
7. Method Names – All method names should start with a Lower Case letter.
If several words are used to form the name of the method, then each inner word's first letter should be in Upper Case. Example: public void myMethodName().
Java Program to Print Message "This is my first java Program".
Solution: Open notepad and type the program.
Save the program with the name "first.java", Open DOS and type:
Q. Find Sum of 2 numbers.