18/12/24 ---------- Q)What is compilation in C? =>C Compiler translating C source code into machine code(binary code) is nothing but compilation in C. Q)What is compilation in Java? =>Java Compiler translating Java source code into byte code is nothing but compilation in Java. Q)What is byte code? =>Byte code is not machine code understandable to the processor =>Byte code is nothing but intermediatary instructions that can be underandable to any kind of JVM. Q)How are Java programs Platform independent(Operating System independent)? =>Three things contribute to the OS independency of Java programs 1)Java compiler 2)class file format 3)OS dependent JVM =>Java compiler creates same class file in any operating system environment. =>class file contains byte code that is understandable to any JVM. =>OS dependent JVM translates (interprets) byte code into the underlying operating system understandable machine code to be given to the processor. Q)Justify that Java is Platform dependent. =>Here, Java means Java platformI.e. JVM. =>JVMs are OS dependent. Therefore we can say that Java is platform dependent. =>But Java programs are platform(OS) indepedent. Q)What is source code? =>Human readable text expressed in Some Programming language that solves a computing problem is nothing but source code. Note:- Program code is nothing but source code Q)What is a source file? =>A text file that contains the source code of a computer program is nothing but a source file. Q)What is the entry point of a Java program? =>Program's execution stars from which point(part), it is known as an entry point. =>Entry point of a Java program is "main method". Q)Explain about the following program. 1 class HelloWorld{ 2 public static void main(String args[]){ 3 System.out.println("Hello World !"); 4 } 5 } Program's Explanation ------------------------- 1:- class Declaration+ class definition stars({) =>"class" is a keyword =>"HelloWorld" is the name of the class(identifier) =>Here, class is defined to encapsulate main method =>Coding convention is that always class name should start with upper case letter.When the name of the class is concatination of more than one word, every next word first letter should be in upper class. 2:- main method header+ main method body starts({) 3:- body of main method. =>Task perfroming code enclosed between two flower braces of the method is nothing but "method body" =>main method is calling println method. 4:-main method definition ends 5:- class definition ends