Core Java Interview Questions- Part 6

Core Java Interview Questions- Part 6
Java is a versatile language that is used in mobile apps, Software, and smart devices. After the advancements in fields like Machine learning, robotics, and artificial, Java use cases have increased too. Due to its features, flexibility, and vast support, it is a critical language to succeed in the tech world today.

So, if you looking for a career in tech, make sure you know Java. Our 200 core Java interview questions will help you grasp the basic concepts. Once you have mastered the Java basic concepts, you can step into any career that requires Java.

Our interview questions page will help you get ready for a career in Java as it includes clear explanations.  So, let’s start practicing the Java concepts by going through the questions.

Answer:

Core Java is not just the programming language, but it is a collection of libraries. It is the purest form of Java used for general desktop application development. Core Java is the subset of Java SE (Standard Edition) technologies that comprises both general & special purpose API’s.

Answer:

Follow these steps to enable Java into Chrome:

  • Click on the Security tab in Java Control Panel;
  • Thereon, select the option Enable Java content in the browser;
  • Click Apply & OK to confirm the changes;
  • Finally, restart the browser to enable the changes.

Answer:

HashMap uses it’s inner class Node<K,V> for storing map entries. HashMap stores entries into multiple singly linked lists, called buckets or bins. HashMap uses hashCode() and equals() methods on keys for get and put operations.

Answer:

Once a program written in Java has converted to bytecode, it can be transferred across a network & executed by JVM. Bytecode files generally have a .class extension. It is the compiled format for Java programs.

Answer:

Below are the fundamental steps to connect database in Java:

  • Import JDBC packages.
  • Load & register the JDBC driver.
  • Open a connection to the database.
  • Create a statement object to perform a query.
  • Execute the statement object & return a query ResultSet.
  • Process the ResultSet.
  • Close the ResultSet & statement objects.
  • Close the connection.

Answer:

An enum refers to a special “class” representing a group of constants like unchangeable variables or final variables. To create an enum in Java, you should use an enum keyword instead of an interface or class & separate the constants with a comma.

Answer:

DAO or Data Access Object is a structural pattern that enables us to isolate the business or application layer from the persistence layer using an abstract API (Application Programming Interface).

Answer:

AWT or Abstract Window Toolkit is Java’s original platform-dependent graphics, windowing, & user-interface widget toolkit. AWT is a part of JFC (Java Foundation Classes), the standard API for providing a GUI for a Java program. It is also a GUI toolkit for several Java ME profiles.

Answer:

Framework in Java is a collection of predefined functions & classes used to process input, manage hardware devices interacts with system software. It helps developers to build an application by writing their own code.

Answer:

Follow these steps to update Java:

  • Go to the Windows Start Button & select Settings, then Control Panel.
  • Click Java (an icon of a coffee cup with steam) in the Control Panel list.
  • Select the Update tab, then click on the Update Now button & make the changes.

Answer:

A variable is a part of memory that contains a data value. Java variables are typically used to store information, which your Java program needs to perform its job.

Answer:

A functional interface in Java refers to an interface with only one abstract method, meaning that the interface implementation will only represent one behavior.

Answer:

At first, Java was called Oak, named after an oak tree that stood external to Gosling’s office. Later, the task passed by the name Green and finally, it was renamed Java, inspired by an Indonesian coffee brand, Java.

Answer:

Static methods can be called directly inside a class without using an object. Static variables are shared amongst all instances of a class. Static blocks are code blocks that are loaded like a class is loaded in the memory.

Answer:

In Java, a static method is a method that belongs to a class rather than an instance of a class. The method is accessible to every instance of a class, but methods defined in an instance are only able to be accessed by that object of a class.

Answer:

An interface is a collection of static methods, constants, default methods, and abstract methods.

Answer:

Abstraction is achieved by using two ways in Java, i.e., abstract class & abstract methods.

Answer:

Strings in Java are usually used for HashMap keys. So, if a person changes a string’s value, it will cause severe discrepancies. Therefore, strings are made immutable.

Answer:

Yes, Java interfaces can be inherited. Java supports Hierarchical & Hybrid inheritances through inheritable interfaces.

Answer:

Yes, Java interfaces can have static methods since static methods are treated as default methods, so they don’t need to be implemented.