Core Java Interview Questions

Here Are the Most Frequently asked Core Java Interview Questions and Answers.

In this tutorial, We have covered New Release Core Java interview questions, Please go through this before you head up for freshers and experienced interview on Java.

1 ) Tell some important features of Java version 14 ?

Java version 14 was released on March 17, 2020. It is a Non-LTS version. Some of the developer specific Java 14 Features are:

  1. Switch Expressions
  2. Pattern matching improvements of instanceof operator – Preview Feature
  3. Helpful NullPointerException Messages
  4. Text Blocks – Second Preview
  5. Records – data class, preview feature

2) Tell some important features of Java version 13 ?

Some of the developer specific Java 13 Features are:

  1. Text Blocks – Preview Feature
  2. Switch Expressions – Preview Feature
  3. Re-implementation of Java Sockets API
  4. Dynamic CDS Archive
  5. FileSystems.newFileSystem() Method
  6. DOM and SAX Factories with Namespace support
  7. Unicode 12.1 support
  8. ZGC improvements to return Unused Memory

3) Tell me some important features of Java version 12 ?

Java 12 was launched on March 19, 2019. It is a Non-LTS version. Some of the Java 12 Features are:

  1. Switch Expressions
  2. File mismatch() Method
  3. Compact Number Formatting
  4. Teeing Collectors in Stream API
  5. New Methods in String Class
  6. JVM Constants API
  7. Pattern Matching for instanceof
  8. Raw String Literals is Removed From JDK 12.

4) What are the important features of Java version 11 ?

Java 11 is the second LTS release after Java 8. They’ve changed the licensing and support model which means if you download the Java 11 Oracle JDK, it will be paid for commercial use. If you want to use a free version, you can download it from the OpenJDK website.

Important features are as below :

  1. We can run a java program directly through java command. The source file will be implicitly compiled and executed.
  2. There are new methods added in String class – isBlank(), lines(), strip(), stripLeading(), stripTrailing(), and repeat().
  3. Files class got two new methods to read/write string data – readString() and writeString().
  4. We can use “var” with lambda expressions also.
  5. Epsilon: A No-Op Garbage Collector for test environments.
  6. Java EE and CORBA Modules have been removed from the standard JDK build.
  7. Nashorn JavaScript Engine has also been deprecated.

5) What are the important features of Java 9 release?

The Java 9 was a major release and comes with a lot of features. Some of the important features are:

  1. Java 9 REPL (JShell)
  2. Java 9 Module System
  3. Factory Methods for Immutable List, Set, Map and Map.Entry
  4. Private methods in Interfaces
  5. Reactive Streams
  6. GC (Garbage Collector) Improvements

6) What are the important features of Java 8 release?

It is most asked interview question in the java programming. Below are the features:

  1. Interface changes with default and static methods
  2. Functional interfaces and Lambda Expressions
  3. Java Stream API for collection classes
  4. Java Date Time API

7) What are the OOPS Concepts in Java?

Java is Object Oriented Programming Concepts, Below are some of the OOPS concepts in java programming:

  • Abstraction
  • Encapsulation
  • Polymorphism
  • Inheritance
  • Association
  • Aggregation
  • Composition

8) What do you understand by platform independence of Java?

Platform independence means that you can run the same Java Program in any Operating System. For example, you can write java program in Windows and run it in Linux.

9) What is JVM (Java Virtual Machine) and is it platform independent?

Java Virtual Machine (JVM) is actually the heart of java programming language. JVM is responsible for converting byte code into machine-readable code. The JVM is platform-dependent, that’s we have different JVM for different operating systems. We can customize JVM with Java Options, such as allocating minimum and maximum memory to JVM. It’s called virtual because it provides an interface that doesn’t depend on the underlying OS.

10) Explain difference between JDK and JVM?

Java Development Kit (JDK) provides all the tools, executables and binaries required to compile, debug and execute a Java Programs.
Java Virtual Machine (JVM) executes the java programs.

11) What is the difference between JVM and JRE?

Java Runtime Environment (JRE) is the implementation of JVM. JRE consists of JVM and java binaries and other classes to execute any program successfully. JRE doesn’t contain jdk. If you want to execute any java program, you should have JRE installed.

12) What is the superclass of all classes in Java?

java.lang.Object is the root class for all the java classes.

13) Does java support multiple inheritance?

Yes, We can achieve multiple inheritance using interface implementation in Java.

14) Why People say Java is not pure Object Oriented language?

Java is not said to be pure object-oriented because it supports primitive types such as int, byte, short, long, etc.

15) What is difference between path and classpath variables?

PATH is an environment variable used by the operating system to locate the executables classes. That’s why when we install Java or want any executable to be found by OS, we need to add the directory location in the PATH variable.

Classpath is specific to Java and used by java executables to locate class files. We can provide the classpath location while running java application and it can be a directory, ZIP files, JAR files, etc.

16) Explain the use of main method in Java?

main() method is the entry point of any standalone java application.

Java’s main method is public and static so that Java runtime can access it without initializing the class. The input parameter is an array of String through which we can pass runtime arguments to the java program.

17) What is overloading and overriding in java?

Overloading is about having same function with different signatures. Overriding is about same function, same signature but different classes connected through inheritance. Overloading is an example of compile time polymorphism and overriding is an example of run time polymorphism.

18) Can we overload main method?

Yes we can have multiple main method in a single class. However if we run the class, java runtime environment will look for main method with syntax as public static void main(String args[]).

19) Can we have multiple public classes in a java source file?

No we can not have more than one public class in a single java source file. A single source file can have multiple classes but can only have one public class.

20) What is package in Java ?

Java package is the mechanism to organize the java classes by grouping them.
We can have the grouping logic based on functionality or modules. A java class fully classified name contains package and class name.Example, java.lang.Object is the fully classified name of Object class that is part of java.lang package.

Before you head for core java interview , Please check out the most important java 8 interview questions here .

Leave a Reply 0

Your email address will not be published. Required fields are marked *