What is Java?

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 in JAVA?

  • 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 main thread. The user can create multiple threads by extending the thread class or by implementing Runnable interface.

How does Java enable high performance?

Java uses Just In Time compiler to enable high performance. JIT is used to convert the instructions into bytecodes.

What are the Java IDE’s?

Visual Studio, Eclipse and NetBeans are the IDE’s of JAVA.

What do you mean by Constructor?

  • 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 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 Local variable and Instance variable?

Local variables are defined in the method and scope of the variables that have existed inside the method itself.

An instance variable is defined inside the class and outside the method and scope of the variables exist throughout the class.

What is a Class?

All Java codes are defined in a class. A Class 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.

public class Addition { // Class name declaration
int a = 5; // Variable declaration
int b = 5;
public void add() { // Method declaration
int c = a + b;
}
}

What is an Object?

An instance of a class is called object. The object has state and behavior.

Whenever the JVM reads the “new()” keyword then it will create an instance of that class.

public class Addition {
public static void main(String[] args) {
Addition add = new Addition();// Object creation
}
}

What are the Oops concepts?

What is meant by Method Overriding?

Method overriding happens if the sub class method satisfies the below conditions with the Super class method:

  • Method name should be same
  • Argument should be same
  • Return type also should be same

What is meant by Overloading

Method overloading happens for different classes or within the same class.

For method overloading, subclass method should satisfy the below conditions with the Super class method (or) methods in the same class itself:

  • Same method name
  • Different argument type
  • May have different return types

Sources:
https://www.softwaretestinghelp.com/core-java-interview-questions/