Java Questions

Q:

What are the steps required to execute a query in JDBC?

Answer

First we need to create an instance of a JDBC driver or load JDBC drivers, then we need to register this driver with DriverManager class. Then we can open a connection. By using this connection , we can create a statement object and this object will help us to execute the query.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1769
Q:

What is abstract method?

Answer

abstract method is a method declared with abstract modifier but  with out body.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1764
Q:

What are wrapped classes ?

Answer

Wrapped classes are classes that allow primitive types to be accessed as objects.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1754
Q:

What is the similarity between Dynamic Binding and linking?

Answer

Dynamic binding is orthogonal to dynamic linking. Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic binding It is associated with polymorphism and inheritance, it(also known as late binding) means that the code associated with a given procedure call is not known until the time of the call at run-time.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1748
Q:

What is the purpose of the wait(), notify(), and notifyAll() methods ?

Answer

The wait(), notify(), and notifyAll() methods are used to provide an efficient way for threads to wait for a shared resource. When a thread executes an object's wait() method, it enters the waiting state. It only enters the ready state after another thread invokes the object's notify() or notifyAll() methods..

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1739
Q:

What is an abstract class?

Answer

An abstract class is an incomplete class. An abstract class is defined with the keyword abstract . We cannot create an object of the abstract class because it is not complete. It sets a behavioral protocol for all its child classes.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1736
Q:

How many types of classes are there in Java?

Answer

Two types of classes:


1) Top Level Class


2) Classes within Class


       i) member classes


             a) static member class


             b) non static member class


      ii) local classes


      iii) anonymous classes

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1734
Q:

How to call a constructor in java?

Answer

Constructor chaining is the process of calling one constructor from another constructor with respect to current object.





Within same class: It can be done using this() keyword for constructors in same class


From base class: by using super() keyword to call constructor from the base class.

Report Error

View answer Workspace Report Error Discuss

1 1732