Compiling and executing a java program

Posted On // 1 comment
The name of the main class and name of file must be same.
The naming is case sensitive.
The name of the java file should be classname.java
To compile the '.java' file.
  1. Open command prompt.
  2. Type "javac classname.java".
classname.java is the filename of the java file.
In order to execute a java file just type "java classname" in cmd.
cmd is the abbreviation for "command prompt".
In order to copy the output from cmd just
  1. Right click on cmd window click edit then click mark. 
  2. Then drag your mouse along the portion in cmd window that you would like to copy. 
  3. Press enter key on your keyboard.
  4. The output is now copied. You may paste it anywhere you like.

1 comment :