Ques.1. What is Java?
Ans. Java is an object-oriented programming language, developed in 1995 by Sun Microsystems. It is a computer-based platform and is used to develop applications.
Ques.2. What are some features of Java?
Ans. Some of the major features of Java are-
- It is simple and easy to learn with a simple syntax.
- It is an object-based language. This means it is easier to implement, and can easily be extended.
- The Java platform has null interactions with the OS when a program is run. This makes it very secure as the program is developed without any virus and is tamper-free.
- It is architectural-neutral; this means a compiled code can be run on various processors in the presence of a Java runtime system.
- Programs written in Java can perform various tasks simultaneously. This multi-threaded feature is very helpful in creating interactive applications.
Ques.4. What is JDK?
Ans. JDK means Java Development Kit. This term should not be confused with JRE and JVM. The JDK provides an environment to build, run, and execute programs. All the development tools required to develop a program and the JRE come inside the JDK.
Ques.5. What is Javac?
Ans. The compiler used in Java is called Javac. The compiler itself comes inside the JDK. The purpose of it is to convert the Java program code line by line into bytecodes for the JVM to understand. The Javac can either be invoked by typing ‘Javac Filenamesaved.Java’, or by using the Java compiler API like the one in Eclipse IDE.
Ques.6. What is JRE?
Ans. JRE is Java Runtime Environment. The JRE is the platform that provides the environment for the Java programs to run (keep in mind: to run and not develop). It is the top layer that is used by us, the end-users.
It consists of the JVM + library classes + supporting tools and is part of the JDK. The programs are run on JRE as it loads the classes, verifies the access to the memory, and retrieves system resources.
Ques.7. What is JVM?
Ans. The JVM (Java Virtual Machine) is the interpreter and is the core of both JDK and JRE. The JVM verifies and executes the program line by line once the program is converted into Bytecode. It consists of a class loader. Memory area, execution engine, JNI, and Native method libraries.
Ques.8. Why is Java considered platform-independent?
Ans. Java is called platform-independent, as the code compiled in Java can run on all OS irrespective of on which it was created. The code created in Java is compiled into an intermediate language called the Bytecode, which is understood by JVM and converted into native machine-specific language based on which OS it is being run on.
The other languages like C are saved in .exe format and are compiled directly into machine-specific language according to the OS being used. This means a code compiled on Microsoft OS cannot run on Linux OS.
However, the code in Java is first converted into an intermediate Bytecode language therefore if the OS supports the JVM the code can be executed easily (remember, Java is platform-independent but the JVM is not).
Read Complete Post : Top 100 Core Java Interview Questions [Updated 2021]