Java Questions

Q:

why protected modifier?

Answer

Outside the package if any other class other than JVM calls the finalize method our class then it is not allowed

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 2081
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 2080
Q:

Client code having direct access to internal data is called

A) Encapsulation B) DataHiding
C) Polymorphism D) DataAbstraction
 
Answer & Explanation Answer: B) DataHiding

Explanation:

Client code must use setters and getters to access internal data in DataHiding

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 2031
Q:

What is difference between methods and blocks?

Answer

Method contains name, parameters, return type and executable body. But block does not contains name, parameters, return type.It contains only executable body.


Methods are executed by method call statements. Blocks are executed automatically with class loading and with object creation.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 2019
Q:

What is the difference between a constructor and a method?

Answer

A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. We cannot invoke a constructor directly.


 


A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 2014
Q:

Which package is imported by default?

Answer java.lang package is imported by default even without a package declaration.
Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 2011
Q:

What is Spring IoC container ?

Answer

The Spring IoC is responsible for creating the objects,managing them (with dependency injection (DI)), wiring them together, configuring them, as also managing their complete lifecycle.

Report Error

View answer Workspace Report Error Discuss

Subject: Java Exam Prep: Bank Exams
Job Role: Analyst , Project Manager , Software Architect

3 2007
Q:

What is wrapping?

Answer

Wrapping is also called as packing or boxing.


Storing the data inside the object as private data which can accessed outside the class only by using methods.


 

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1988