Java Questions

Q:

How to do MultiThreading in Java?

Answer

To do multi threading in java we use interfaces and classes defined in java.lang package.


Those classes and interfaces are:


Java.lang.Runnable, Java.lang. Thread, Java.lang.ThreadGroup

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1706
Q:

How to create Directory on the HD?

Answer

To create directory on the HD we use mkDir() method:


boolean mkDir();


This method returns true if the directory is created on HD


This method returns false if the directory is already existing on HD

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1705
Q:

What is the use of overriding?

Answer

- By using method overriding a sub class can change the definition of super class method.


- By using overriding a sub class can modify the functionality of the super class.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1695
Q:

What is DriverManager ?

Answer

DriverManager is a class in java.sql package. It is the basic service for managing a set of JDBC drivers.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1693
Q:

why overriding finalize() method?

Answer

If constructor opens the file 


finalize() method closes that file.


 


If constructor opens the connection 


finalize() method closes that connection.


 


To perform finalization operation we must overriding finalize method.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1693
Q:

What is the SimpleTimeZone class?

Answer

SimpleTimeZone is a concrete subclass of TimeZone class. The TimeZone class represents a time zone, that is to be used with Gregorian calendar.


The SimpleTimeZone is created by using the base time zone offset from GMT time zone ID and rules, for starting and ending the time of daylight.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1680
Q:

What is static initializer block? What is its use?

Answer

A static initializer block is a block of code that declares with the static keyword. It normally contains the block of code that must execute at the time of class loading. The static initializer block will execute only once at the time of loading the class only.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1680
Q:

What is the use of super call?

Answer

By using super call we can call super class constructors  from sub class constructors and we can initialize super class private data.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1680