Q1 : Why Java ? (compare Java with other languages or what are advantages / features of Java) ?
A1 :
Java is a robust, architecturally neutral, portable, interpreted, threaded, dynamic & high performance language. Java is object-oriented this means you can write modular programs & reusable code. Java enables the development of robust applications on multiple platforms in heterogeneous, distributed networks.
Java was designed to be easy to use and is therefore easy to write, compile, debug, and
learrn than other programming languages.
Java is open source, so users dont have to struggle with heavy license fees every year.
Java has automatic memory management by garbage collection mechanism.
Java is a write once, use anywhere language, because of bytecode & JVM.
Java does not include structures or unions because the traditional data structures are implemented as an object oriented framework.
Q2 what is JVM ( Java virtual machine) & bytecode ?
A2 : A Java virtual machine is software implemented on hardware and on standard operating systems, hardware can be virtual or real. JVM provides the environment on which bytecode execution occurs.
JVM instance starts automatically when a java program is run, so when on a single pc, you run 3 java programs, 3 instances of JVM will be created and destroyed after program execution is over, automatically. Task of JVM is to interpret the bytecode.
While JVM makes Java platform independent,the JVM itself is a platform dependent instance.
Java bytecode is the form of instructions that the Java virtual machine executes. Each bytecode opcode is one byte in length,
Q3. what is a daemon thread, what is non-daemon thread ?
A3 :
A daemon thread is ordinarily a thread used by the virtual machine itself, such as a thread that performs garbage collection. The application, however, can mark any threads it creates as daemon threads. The initial thread of an application–the one that begins at main()–is a non- daemon thread.
A Java application continues to execute (the virtual machine instance continues to live) as long as any non-daemon threads are still running. When all non-daemon threads of a Java application terminate, the virtual machine instance will exit. If permitted by the security manager, the application can also cause its own demise by invoking the exit() method of class Runtime or System.
In the Echo application previous, the main() method doesn’t invoke any other threads. After it prints out the command line arguments, main() returns. This terminates the application’s only non-daemon thread, which causes the virtual machine instance to exit.

