Java Questions

Q:

What is Constructor?

Answer

Constructor is not a special method.


Constructor is block of code that is executed automatically whenever object of the class is created.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1591
Q:

What is JDBC ?

Answer

JDBC technology is an API (included in both J2SE and J2EE releases) that provides cross-DBMS connectivity to a wide range of SQL databases and access to other tabular data sources, such as spreadsheets or flat files. With a JDBC technology-enabled driver, you can connect all corporate data even in a heterogeneous environment.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1584
Q:

What is the differnce among public, protected and package access data?

Answer

If we are not using packages and if we are not using inheritance then there is no difference among public, protected and package access data.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1584
Q:

What is difference between Path and Classpath?

Answer

Path and Classpath are operating system level environment variales. Path is used define where the system can find the executables(.exe) files and classpath is used to specify the location .class files.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1574
Q:

Why interface data is static?

Answer

Interface data is static data why bcoz interface supports multiple inheritance.


if inteface data is non-static then there is chance for replication of the data (bcoz of replication of data ambiguity problem occurs )

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1571
Q:

How to call argument constructor?

Answer

new ClassName( arg1, arg2, .... argN);


Ex:


Class sample {


   Sample(int a) {


   System.out.println("arg con a =" +a);


   }


}


class Demo {


    Public static void main( String[] args) {


     Sample s1= new Sample(23);


     Sample s2= new Sample(45);


    }


}

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1563
Q:

What is the use of overloading ? or why overloading?

Answer

By using overloading we can add new functionality to the sub class.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1562
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 1561