30/12/24 ---------- Q)Which software executes a Java program? =>Java Virtual Machine(JVM) Q)What is the entry point of a Java program? =>Program's execution starts from which part, that part is known as the entry point of the Java program. =>main method is the entry point of a Java program. 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/body starts =>"class" is a keyword in Java. =>"HelloWorld" is the name of the class. =>HelloWorld class is used to encapsulate main method. 2:- main method header+main method definition starts. 3:- main method is calling the println method. 4:- main method definition ends/main method body ends 5:- class definition ends. 6:- main method definition ends Q)How to display data on the console(Monitor) in a Java application? =>by using println method. Q)Why is main method declared public? =>To give access permission to the JVM to call the main method, it is declared public . Q)Why is main method declared static? =>to fecilitate the JVM to call the main method without the need of creating the object of the class. Q)Explain about portability of Java applications. =>The ability of a program to run even if its source code is moved from one type of machine to the other type of machine. Q)What is byte code? =>byte code is not machine code. =>".class" file contains byte code. =>Intermediatory instructions that are understadable to any JVM is nothing but byte code. Q)Explain about OS(Platform) independency of Java applications. =>The ability of a Java program to run in any machine even if it is moved from one machine to another machine after compilation. =>Three things contribute to the Platform independency of Java applications. 1)Java compiler 2)OS dependent JVM 3)class file format =>In any Operating system environment, Java compiler creates the same class file. =>class file contains byte code which is understandable to any kind of JVM. =>JVM is OS dependent. It translates the class file content into underlying operating system understandable machine code to be given to the processor.