Java Questions

Q:

What is classloader?

Answer

The classloader is a subsystem of JVM that is used to load classes and interfaces.There are many types of classloaders e.g. Bootstrap classloader, Extension classloader, System classloader, Plugin classloader etc.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1770
Q:

What is the purpose of garbage collection in Java, and when is it used ?

Answer

The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1747
Q:

How do you decide when to use ArrayList and When to use LinkedList?

Answer

If you need to support random access, without inserting or removing elements from any place other than the end, then ArrayList offers the optimal collection. If, however, you need to frequently add and remove elements from the middle of the list and only access the list elements sequentially, then LinkedList offers the better implementation.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1746
Q:

What is diamond problem?

Answer

The diamond problem is an ambiguity that can occur when a class multiply inherits from two classes that both descend from a common super class

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1739
Q:

What is encapsulation?

Answer

Encapsulation describes the ability of an object to hide its data and methods from the rest of the world 

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1732
Q:

What is static member class?

Answer

Static member class is a class defined inside outer class with static modifier.


EX:


Class A {  //top level class or outer class


    .....


    static class B {  //static member class


    }


   .....


}

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1718
Q:

What is the difference between path and classpath?

Answer

Path contains path of .exe files(commands).


Classpath contains path of packages. packages can be stored in folder or .jar files

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1709
Q:

Warning implicit declaration of function?

Answer

Function: A Function is a block of statement which perform some operation.



Declaring the function before using the function in program is known as implicit declaration of the function.



For Example::


int bar(void); // function (forward) declaration



int main(void) {


bar(); // bar was declared, the compiler has all the info


return foo(123); // foo not yet known; impl. decl. warning


}



// not previously declared function definition


int foo(int a) {


return a;



// previously declared function definition


int bar() {


return 321;


}

Report Error

View answer Workspace Report Error Discuss

Subject: Java
Job Role: IT Trainer , Analyst

1 1708