-
What is JAVA?
Answer: Java is a high-level programming language and is platform-independent.
Java 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.
-
What are the features of JAVA?
Answer:
Features of Java are as follows:
OOP concepts 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.
-
How does Java enable high performance?
Answer: Java uses Just In Time compiler to enable high performance. It is used to convert the instructions into bytecodes.
-
Name the Java IDE’s?
Answer: Eclipse and NetBeans are the IDE’s of JAVA.
-
What do you mean by Constructor?
Answer: Constructor can be explained in detail with enlisted points:
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.
-
What is meant by the Local variable and the Instance variable?
Answer:
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.
-
What is a Class?
Answer: All Java codes are defined in a Class. It has variables and methods.
Variables are attributes which define the state of a class.
Methods are the place where the exact business logic has to be done. It contains a set of statements (or) instructions to satisfy the particular requirement.
-
What is an Object?
Answer: An instance of a class is called an object. The object has state and behavior.
Whenever the JVM reads the “new()” keyword then it will create an instance of that class.
-
What are the OOPs concepts?
Answer: OOPs concepts include:
Inheritance Encapsulation Polymorphism Abstraction Interface
-
What is Inheritance?
Answer: Inheritance means one class can extend to another class. So that the codes can be reused from one class to another class. The existing class is known as the Super class whereas the derived class is known as a sub class.
-
What is Encapsulation?
Answer: Purpose of Encapsulation:
Protects the code from others. Code maintainability.
-
What is Polymorphism?
Answer: Polymorphism means many forms.
A single object can refer to the super-class or sub-class depending on the reference type which is called polymorphism.
-
What is meant by Method Overriding?
Answer: Method overriding happens if the sub-class method satisfies the below conditions with the Super-class method:
Method name should be the same The argument should be the same Return type should also be the same
The key benefit of overriding is that the Sub-class can provide some specific information about that subclass type than the super-class.