Core Java Interview Questions- Part 3

Core Java Interview Questions- Part 3Java’s popularity is beyond measurement. It has been persistently ranked among the top programming languages in TTYL and various other industry surveys and is considered one of the most globally used programming languages. Thus, learning Core Java can open up a wide range of career opportunities in software development.

Learning Core Java is an excellent investment for anyone who wants to pursue a career in software and web development, as it provides a strong foundation for building a variety of applications and systems.

To succeed in a Core Java interview, you must prepare common technical interview questions and enhance your hands-on practical skills. Here are the most asked Core Java interview questions to help you ace your next Core Java interview:

Answer:

RMI or Remote Method Invocation is a mechanism to create the distributed Java applications. RMI allows an object to access & invoke methods on an object running on another system or JVM.

Answer:

In Java, Multithreading is a process of executing multiple threads at the same time for maximum utilization of the CPU. A thread in Java is a lightweight process requiring fewer resources to create and share the process resources.

Answer:

A daemon thread is the low priority thread that provides background services & support to the user threads. It gets automatically terminated by the Java Virtual Machine if the program only remains with the daemon thread, and all the other user threads are ended or dead.

Answer:

In Java, Thread Scheduler is the component of Java Virtual Machine that determines the execution order of multiple threads on a single processor. It decides the order in which threads should run and the process is called thread scheduling in Java.

Answer:

In Java, Multithreading is a process of executing multiple threads at the same time for maximum utilization of the CPU. A thread in Java is a lightweight process requiring fewer resources to create and share the process resources.

Answer:

Following are the key differences between Synchronous & Asynchronous programming:

  • Asynchronous is multi-thread, which means operations or programs can run in parallel. Synchronous is single-thread, so only one operation or program will run at a time.
  • Asynchronous is non-blocking, which means it will send multiple requests to a server. Whereas, Synchronous is blocking — it will only send the server one request at a time and will wait for that request to be answered by the server.
  • Asynchronous increases throughput because multiple operations can run at the same time. Synchronous is slower and more logical.

Answer:

The process of removing a heap of unused objects from the memory to make space for JVM is called garbage collection. It is performed for automatic memory management.

Answer:

Java Reflection is a process that analyzes & modifies the capabilities of a class at runtime. Reflection API in Java is used for manipulating class & its members at runtime, including methods, fields, constructors, etc.

Answer:

Following are the major differences between HashSet & TreeSet:

  • HashSet uses HashMap to store its elements internally, while TreeSet used TreeMap.
  • HashSet stores objects in random order; on the contrary, TreeSet stores data in sorted order.
  • HashSet is speedier & faster than TreeSet.

Answer:

Following are the seven best Java IDEs:

  • Eclipse
  • NetBeans
  • IntelliJ IDEA
  • BlueJ
  • JDeveloper
  • JCreator
  • DrJava

Answer:

The JDBC DriverManager class is an interface between driver & the user. It keeps track of available drivers & handles establishing a connection between the appropriate driver & a database. The DriverManager class helps in maintaining a list of registered Driver classes by calling the method DriverManager.registerDriver() method.

Answer:

Java Virtual Machines (JVM) allows Java programs to run on any operating system or device and manages or optimizes program memory. Whereas, Java Runtime Environment (JRE) is a software layer that runs on top of the operating system software. It provides class libraries & other resources that a Java program needs to run. JRE has three interrelated components for running & developing Java programs.

Answer:

Object Serialization is a process of converting a state of an object into a byte stream, which can be persisted into a file or sent over the network to another running JVM.

Answer:

A singleton class is a class with only one instance at a time. After the first time, if we try to instantiate the Singleton class, the new variable also points to the first instance created.

Answer:

The ternary operator or provisional operator is used to making a decision. It is a simplified version of if & else conditional statements used to assign values to variables.

Answer:

A vector class is an ArrayList similar to a data structure whose size increases as per the demands. It supports some legacy functions not supported by collections. Unlike collection objects, the vector class is more suitable to work with threads.

Answer:

Implicit objects are a set of objects in Java that the JSP container provides to developers on each page. These objects are accessible as built-in variables through scripting elements & can also be accessed programmatically by Servlets or JavaBeans.

Answer:

Lazy loading is a type of fetching technique that decides whether to load a child object while loading the parent object or not. It is used for all the entities of Hibernate.

Answer:

In Java, Unicode is a two-byte character code that is used to represent the characters. It defines all the international characters found in different human languages.

Answer:

Dynamic initialization is a process wherein the initialization value of a variable is unknown when the program is compiled. It means that the initial value of an object is yet to be provided during runtime.