Compiling and executing a java program is done in the command prompt in Windows.
Compiling a program
file_name : Name of the file with which the java program is saved. The file should be saved with a .java extension.
java : The java interpreter.
class_name : Name of the class in which the main() is written.
Note : When a class is declared public, the class name and the file name should be matched.
Compiling a program
javac file_name.javaExecuting a java program
java class_namejavac : The java compiler.
file_name : Name of the file with which the java program is saved. The file should be saved with a .java extension.
java : The java interpreter.
class_name : Name of the class in which the main() is written.
Note : When a class is declared public, the class name and the file name should be matched.
No comments:
Post a Comment