28/12/24 ---------- Q)What is source code ? =>Human readable text expressed in any Programming Language is nothing but source code. Note:- Program code is nothing but the source code. Q)What is a source file? =>Text file that contains the source code of a program is nothing but a source file. Q)What is compilation in C? =>C compiler translating the C source code into machine code(binary code) is nothing but compilation in C. Q)What is compilation in Java? =>Java compiler translating the Java source code into byte code is nothing but compilation in Java. Q)How to develop and run a Java Application? Step 1:- write/edit the source code Step 2:- Save the source code(create the source file). Step 3:- compile the source code of the source file. Step 4:-execute the program. DIAGRAM Q)Develop a Java application that displays Hello World! on the console. class Hello World{ public static void main(String[] args) { System.out.println("Hello World!"); } } Q)How to compile a Java program? =>By using "javac" command For eg. javac one.java Q)What happens in the background when "javac" command is used? =>"javac" command is given to the Operating System =>Operating System invokes the compiler. =>Java compiler does the following things. 1)It makes a full read of the source code of the source file. 2)It verifies the syntactical correctness of the source code. case i:- syntactical errors are found Java compiler reports the errors and it doesn't perform translation. case ii:- no syntactical errors are found. =>Java compilers translates the source code into byte code. I.e. it generates one or more ".class" files. Q)How to run/execute a Java program? =>by using "java" command For eg. java HelloWorld Q)Who executes a Java program? =>JVM Q)What happens in the background when java command is executed? =>java command is given to the Operating System. =>The OS invokes the JVM. =>JVM does the following things. 1)JVM loads the specified class file(For eg. HelloWorld.class) 2)JVM calls the main method and the program's execution starts