Core Java interview questions and Answers

Last updated on Feb 06, 2023
  • Share
Core Java interview questions

Core Java, or Java Standard Edition (SE) is a computing platform for building standalone applications or system software. Using Java programming language, Core Java is a part of the Java software family. In Core Java, you will understand the basic Java programming concepts that are used in all classes from Java EE to desktop applications. Java SE also defines general-purpose APIs and includes Java Language Specification and Java Virtual Machine Specification. Oracle Corporation's Java Development Kit (JDK) is one of the most popular implementations of Java SE. You can now read our vast collection of latest core java interview questions.

Most Frequently Asked Core Java interview questions

Here in this article, we will be listing frequently asked Core Java interview questions and Answers with the belief that they will be helpful for you to gain higher marks. Also, to let you know that this article has been written under the guidance of industry professionals and covered all the current competencies.

Q11. What is static import in Java? Explain
Answer

The static import feature allows the static member of a class to be accessed directly without using the qualified name. The biggest advantage of this feature is that less coding will be required if you have access to a static member.

Q12. What is an interface in Java? Explain
Answer

It is a reference type that is similar to a class in Java. It is a collection of abstract methods that is used for full abstraction. An interface may have methods and variables but the methods in interface are abstract by default.

Q13. Explain the difference between abstract class and interface in Java?
Answer
  Abstract Class Interface
1. Can have members, constants, defined methods and method stubs Can only have methods stubs and constants
2. Methods and members can be defined with any visibility Methods must be defined as public
3. May contain non-final variables. Variables declared are by default final
Q14. What do you mean by Marker interface in Java?
Answer

It is an interfaces that has no field or methods (empty interface). It helps in conveying to the JVM that the class that is implementing the interface of a category will have special behavior. It is also known as tag interface.

There are 4 major marker interfaces:

  • Searilizable interface
  • Cloneable interface
  • Remote interface
  • ThreadSafe interface
Q15. What do you mean by Java Annotations?
Answer

Annotation is a tag in Java that represents metadata attached with a class, method, interface, or field. It provides supplement information to be used by compiler and JVM. Annotations do not change a compiled program's action and they are not pure comments.

If you are preparing for interviews, you can check core java interview questions and answers for more insight.

Q16. What do you mean by inner class in java? Explain
Answer

It is a class that is a member of another class.

There are 4 types of inner classes:

  • Nested Inner class
  • Method Local inner classes
  • Anonymous inner classes
  • Static nested classes
Q17. What do you mean by Classloader in Java?
Answer

Class loaders help in loading classes during runtime to the Java Virtual Machine. In addition, they are part of the Java Runtime Environment. Hence, due to class loaders, JVM is not required to know the underlying files for running programs.

Q18. List the different types of classloaders in java.
Answer

There are 3 types of built-in Class Loaders:

  • Bootstrap Class Loader: Loads internal classes
  • Extensions Class Loader: Loads classes from extensions directory
  • System Class Loader: Loads classes from the current classpath
Q19. What do you mean by default constructor in Java?
Answer

Java will automatically create default constructors if there are no default constructors written by you.

The default constructor will call parent default constructor and initialize member data variable to default values.

Q20. What do you mean by Garbage Collection used in Java?
Answer

It is the process through which Java programs perform memory management. When the Java programs run on JVM, objects get created in a part of the memory that is dedicated to program. When objects are no longer needed, the garbage collector finds and deletes them to free up program memory.

Development History

J2SE 1.2 was released in December 1998. Subsequent releases of J2SE were done over the years. It was after J2SE 5, in December 2006, Sun replaced "J2SE" with "Java SE" and removed ".0" from the version numbers.

Latest Version

Oracle released Java SE 11.0.1 in Oct 2018, which is the latest release for Java SE 11 Platforms. Get more knowledge on this if you are preparing for core java interview questions and answers.

Our updated core java interview questions for 6 years experience professionals are one of the biggest question bank available online.

Reviewed and verified by Best Interview Question
Best Interview Question

With our 10+ experience in PHP, MySQL, React, Python & more our technical consulting firm has received the privilege of working with top projects, 100 and still counting. Our team of 25+ is skilled in...