Core Java Interview Question
Java is a high-level programming language and is platform-independent.It is a collection of objects. It was developed by Sun Microsystems. There are a lot of applications, websites, and games that are developed using Java.
- Object-oriented
- Inheritance
- Encapsulation
- Polymorphism
- Abstraction
- Platform independent:** A single program works on different platforms without any modification.
- High Performance:** JIT (Just In Time compiler) enables high performance in Java. JIT converts the bytecode into machine language and then JVM starts the execution.
- Multi-threaded:** A flow of execution is known as a Thread. JVM creates a thread which is called the main thread. The user can create multiple threads by extending the thread
class or by implementing the Runnable interface.
Java uses Just In Time compiler to enable high performance. It is used to convert the instructions into bytecodes.
- When a new object is created in a program a constructor gets invoked corresponding to the class.
- The constructor is a method which has the same name as the class name.
- If a user doesn’t create a constructor implicitly a default constructor will be created.
- The constructor can be overloaded.
- If the user created a constructor with a parameter then he should create another constructor explicitly without a parameter.
- Local variables* are defined in the method and scope of the variables that exist inside the method itself.
- Instance variable* is defined inside the class and outside the method and the scope of the variables exists throughout the class.