Saturday, June 08, 2013

Guaranteed asked Java Interview Questions

Leave a Comment Follow us on twitter

Java Interview Questions


These are guaranteed Java Interview Questions that are mostly asked by the interviewer when the focus of the topic is java. In the today’s world when java is in demand and the competition is tough, one should prepare for the java interview questions before going for an interview. So, let’s see the java interview questions.
1. Why multiple inheritance is not possible in java?

>> Multiple inheritance is not permitted in java because it will result into ambiguities and inconsistencies.

2. What is the difference between abstract class and abstract method?

>> Abstract class is a class that is declared abstract while, abstract method is a method without any implementation code.

3. What is the difference between runtime error and exception?

>> Each exception is a run time error, but all the runtime errors are not exceptions.

4. What is Method Overloading?

>> Method Overloading means having more than one method with same name but different number of arguments.
Eg.
class Sample
{
void method1()
{
System.out.println("This is method 1");
}
void method 2(int a)
{
System.out.println("This is method "+a);
}
}
class Main
{
public static void main(String args[])
{
Sample object=new Sample();
object.method1();
object.method2(2);
}
}

5. What is Dynamic Method Dispatch?

>> First of all Dynamic method dispatch is the best example of run time polymorphism. Dynamic method dispatch is used to solve the problem of call of overridden method at run time rather than at compile time.

6. Runnable interface comes under which package of java?

>> It comes under java.lang package which is the most basic package used in java.

7. What does JDBC stands for and why do we use it?

>> JDBC stands for Java Database Connectivity and it is used for making the connectivity between java programming language and database.

8. Why we don't use delete operator for memory deallocation?

>> Generally as in C++ we use delete operator to free dynamically allocated memory. Java takes a different approach, it deallocates memory automatically. This technique is also called as Garbage collection.

9. Why we use static in java?

>> Classes are called with the use of their objects. Static is used so that class can be called without using an object of that class.

10. What is Interface?

>> An interface is the collection of methods which does not have any implementation code or we can say that interface is the collection of abstract methods.

Hope that you will these find java questions in your interviews.

0 comments:

Post a Comment