In: Computer Science
Describe the process of writing and running a Java program, referringto the terms "run-time" and "compile-time"
Answer:
Intially we need to open the notepad or any editor which we are familiar with and write the program according to the syntax which is known to us and we must save it with .java notation with the classname of the program which will be stored in hard disk.Next move to run and open command prompt and compile the java program by using javac command along with the file name which will be as javac filename.java, if all the lines of the code of the program are written correct then the compiler will not show any errors and will proceed to run time but if any lines of the code misses the syntax then the compiler will throw or show the errors in command prompt which must be rectified to proceed to run time.In run time the code is executed by using java command in the command prompt along with the filename which will be as java filename which will give the desired output of the program if all the lines of the program is written correctly along with the logic otherwise it will throw the run time error which means that there is error in logic which must be resolved to get the desired output.The below is one of the example of the written and running of the java program.
class MainMethodProgram
{
public static void main(String args[])
{
System.out.println("Hello
world");
}
}
Output :
