Introduction of Java Basic
Rules for class declarations
- Class Names For all class names the first letter should be in Upper Case.
- Method Names All method names should start with a Lower Case letter.
- Program File Name Name of the program file should exactly match the class name.
- public static void main(String args[]) java program processing starts from the main() method which is a mandatory part of every java program.
Example :
public class DemoProgram{
public static void main(String []args){
// write your code
}
}
Environment Setup
- Windows
- Right-click on 'My Computer' and select 'Properties'.
- Click on the 'Environment variables' button under the 'Advanced' tab.
- Click on Path variable
- Append Path variable's value by adding this line
;c:\Program Files\java\jdk\bin
Compile and Run java program
- First point to your java bin directory by using cmd
- Then use following command to compile
javac filename.java - Then run program using following command
java filename.java
No comments:
Post a Comment