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.

Q21. Explain Serialization and Deserialization in Java?
Answer

The process of converting an object into byte sequence that can be persisted to a disk or can be sent through streams is called Serialization.

The reverse process of Serialization, i.e. creating objects from a sequence of bytes is called deserialization.

Q22. How we can run a JAR file through command prompt in Java?
Answer
Q23. Java is Pass by Value or Pass by Reference? Explain
Answer

Java is pass by value because variables are references and their value is passed to the methods.

This question was asked in a lot of latest core java interview questions.

Q24. Why we used break and continue statement in Java?
Answer

When the break statement is inside a loop, the loop gets terminated and the program resumes at the next statement after the loop.

The continue statement can be used in the loop control structure. It causes the loop to jump to the next iteration.

Q25. What do you mean by ternary operator in java?
Answer

It is the only conditional operator that can take three operands and assists in evaluating Boolean expressions. It is a replacement for if-then-else statement and is used a lot to replace the switch. Its goal s to decide what value should the variable be assigned.

Q26. What do you mean by composition in java?
Answer

It is the design technique for implementing has-a relationship in a class. You can use java inheritance or Object composition for reusing the code. You can achieve Java composition by using instance variables that are referring to other objects.

Q27. What is Encapsulation in Java? Explain
Answer

Encapsulation is one of the four OOP concepts. It is a way of wrapping variables and code on data as a single unit. The class variables are hidden from other classes, and can be accessed only through their current class. Therefore, this method is also called data hiding.

Q28. What is the difference between String, String Builder, and Buffer?
Answer
S.no String StringBuffer StringBuilder
1. Immutable Mutable Mutable
2. For logic operations, it is slow Thread-safe Faster and more efficient
3. Use it when immutable structure is required. Use it for creating mutable character sequence but string changes must be synchronized Use it for creating mutable character sequence
Q29. What are different access specifiers in Java? Explain
Answer

Java Access Specifiers regulate access to field, class, and method. Also called as visibility specifiers, they determine if a method or field can be used by another method in some other class. An important part of OOP, they are also used to restrict access.

There are four types of Access Specifiers:

  • Public
  • Private
  • Protected
  • Default
Q30. What do you mean by Ordered and Sorted in collections in Java?
Answer

In an ordered collection, the elements have a specific order, which is independent of the value. For example a List.

In the sorted collection, the collection has an order, and the order depends on the value of the element. For example a SortedSet.

Developers should know everything about core java programs before their next interview.

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...