JAVA: Question Set – 01

JAVA: Question Set – 01

Java is one of the most widely used programming languages. Although founded in 1996, it still holds to be one of the most popular languages to date. The number of people working on Java is increasing daily as most companies have Java as their tech stack.

So as a Java developer or an aspiring Java developer, you must be familiar with the language. To help you prepare for your interview, we have curated a list of top Frequently Asked Advanced Java Developer Interview Questions.

What is Dynamic Method Dispatch in Java?

Dynamic Method Dispatch is also known as Run-time Polymorphism in Java. It is a mechanism in which overridden method is resolved at the run-time. This method deals with resolving a call to an overridden method at runtime rather than compile time. Method overriding is an example of run-time polymorphism.

Why is the garbage collector used in Java?

In Java, the garbage collector is used to identify and remove those objects that are no longer needed in the program. These unwanted objects consume a lot of memory, it is better that we free the memory and allocate it to new objects. This is done by the garbage collector. The process is automatic and performed by the garbage collector and programmers do not need to do it manually.

Why is the intern() method used in Java?

The intern() method is a string method that belongs to the String class in Java. It is used to return a string if found in the String Pool. If the string is not found, a string is created in the String Pool, and its reference is returned.

What is the meaning of Lambda Expressions in Java?

The Java Server Faces are web application frameworks that are used to simplify the development integration of web-based user interfaces. Access to server-side data is allowed. It is an XML document that is represented in the form of a logical tree.

Why is JDBC used?

JDBC stands for Java Database Connectivity. It is basically an API(Application Programming Interface) that is used to connect and execute the query with the database. JDBC is used to make a connection between Java language with other databases. JDBC contains various interfaces and classes that help to connect with the database by sending requests.

What is a thread in Java?

A thread in Java is the path or direction taken when the program is being executed. By the means of a thread, a program can operate more efficiently by doing multiple things simultaneously. Threads allow many tasks to be completed in the background without interrupting the main program.

Commonly, every program has at least one thread known as the Main thread that is provided by the JVM when the program starts executing first. Threads have priority and the higher-priority threads are executed first. We can also name threads as a ‘lightweight process’.

Elaborate on the importance of multithreading in Java.

Multithreading in Java is the process of executing two or more threads simultaneously. Multithreading leads to maximum CPU utilization. Users can do many things simultaneously which saves their time. Also, threads are independent, so if one thread fails to execute, other threads won’t get a problem while executing.

What are Java Server Faces?

The Java Server Faces are web application frameworks that are used to simplify the development integration of web-based user interfaces. Access to server-side data is allowed. It is an XML document that is represented in the form of a logical tree.