Showing posts with label Core Java Interview Questions. Show all posts
Showing posts with label Core Java Interview Questions. Show all posts

Sunday, 21 December 2014

Core Java Interviews Questions Part Five

Que: What is difference between final, finally and finalize ?

Ans: final: final is a keyword, final can be a variable, method or class.You,can't change the value of final variable, can't override final method and  can't inherit final class.
finally: finally block is used in exception handling. finally block is always executed either exception occured or not. finalize():finalize() method is used in garbage collection.finalize() method is invoked just before the object is garbage collected. The finalize() method can be used to perform any cleanup processing.

Que: What is Garbage Collection ?

Ans: Garbage collection is a process of unreferencing  the runtime unused(idle) objects.It is performed for memory management.It removed the unused objects and free the memory area.

Que: What kind of thread is the Garbage collector thread ?

Ans: Daemon thread.

Que: What is the purpose of finalize() method ?

Ans: finalize() method is called just before the object is going to  garbage collected.It is used to perform memory cleanup process.

Que: What is gc() method ?

Ans: gc() method  is a daemon thread. gc() method is defined in System class and Runtime Class that is used to send request to JVM to perform garbage collection.

Que: What is the use of the Runtime class ?

Ans: Runtime class is used to provide access to the Java runtime system.

Que: What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class ?

Ans: The Reader/Writer class is used to  read or write  character-oriented data  and  InputStream/OutputStream class is used to read or write  byte-oriented data.

Que: What is Serialization ?

Ans: Serialization is a process of writing the state of an object(class objects ) into a byte stream(means in a file system).It is mainly used to travel object's state on the network.It is mainly used to write objects state in file system(txt or any).

Que: What is Deserialization ?

Ans: Deserialization is the process of reconstructing the object from the serialized state object .It is the reverse operation of serialization process.

Que: What is transient keyword ?

Ans: If you make any data member as transient type ,you can not  serialized that data member in file while Serialization.

Que: What is Externalizable ?

Ans: Externalizable is an  interface is used to write the state of an object into a byte stream in compressed format.It is not a marker interface.

Que: What is the difference between Serializalble and Externalizable interface ?

Ans: Serializable is a marker interface but Externalizable is not a marker interface.When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject() two methods to control more complex object serailization process. When you use Externalizable interface, you have a complete control over your class's serialization process.

Que: What is reflection ?

Ans: Reflection is the process of examining or modifying the runtime behaviour of a class at runtime.It is used in: IDE tools (Integreted Development Environment) e.g. Eclipse, MyEclipse, NetBeans,Jdeveloper, Debugger, Test Tools etc.

Que: What is difference between ArrayList and Vector ?

Ans:       ArrayList                                      Vector

1) ArrayList is not synchronized.           Vector is synchronized.
2) ArrayList is not a legacy class.          Vector is a legacy class.
3) ArrayList increases its size by 50%   Vector increases its size by doubling the initial
     of the initial array size.                          array size

Que: What is difference between ArrayList and LinkedList ?  

Ans:        ArrayList                                                       LinkedList  

1) ArrayList uses a dynamic array.                      LinkedList uses doubly linked list.
2) ArrayList is not efficient for manipulation      LinkedList is efficient for
because a lot of shifting is required.                      manipulation.(i.e.insertion,deletion)

Que: What is difference between HashMap and Hashtable ?   

Ans:       HasMap                                             Hastable

1)HashMap is not synchronized.            Hashtable is synchronized.
2)HashMap can contain one null            Hashtable cannot contain any null key
key and multiple null values.                   nor value.

Que: What is difference between HashSet and HashMap ?

Ans: HashSet contains only values whereas HashMap contains entry(key,value) pair.

Que: What is difference between TreeSet and HashSet ?

Ans: TreeSet maintains ascending order whereas HashSet maintains no order.

Que: What is difference between Set and List ?

Ans: Set contains only unique elements whereas  List can contain duplicate elements.

Que: What is difference between HashMap and TreeMap ? 

Ans: HasMap can contain one null key  whereas TreeMap can not contain any null key.
and HasMap maintain order whereas TreeMap maintain ascending order.

Que: What is difference between Iterator and ListIterator ?

Ans: Iterator traverses the elements in forward direction only whereas ListIterator traverses the elements in forward and backward direction.Both are defined under util package.

Que: Can you make List,Set and Map elements synchronized ?

Ans: Yes, Collections class provides methods to make List,Set or Map elements to synchronized:

public static List synchronizedList(List l){ }
public static Set synchronizedSet(Set s){ }
public static SortedSet synchronizedSortedSet(SortedSet s){ }
public static Map synchronizedMap(Map m){ }
public static SortedMap synchronizedSortedMap(SortedMap m){ }

Que: What is difference between Iterator and Enumeration ?

Ans: Iterator can traverse legacy and non-legacy elements both  whereas Enumeration can traverse only legacy elements.

Que: What is legacy elements in java ?

Ans: Before Collection Framework, defined several classes and interface that provide method for storing objects. When Collection framework were added in J2SE 1.2, the original classes were reengineered(included) to support the collection interface.
These classes are also known as Legacy classes. All legacy claases and interface were redesign by JDK 5 to support Generics.

Que: What is the Dictionary class ?

Ans: The Dictionary class provides the capability to store key-value pairs.

Que: What is difference between Comparable and Comparator interface ?

Ans:        Comparable                                                  Comparator  
         
1)Comparable provides only one sort of             Comparator provides multiple sort of
     sequence.                                                            sequences.
2)It provides one method named compareTo().  It provides one method named compare().
3)It is found in java.lang package.                      It is found in java.util package.
4)Actual class is modified.                                 Actual class is not modified.
 




       




Core Java Interviews Questions Part Four

Que: What is JDBC ?

Ans: JDBC stands for Java DataBase Connectivity is a Java API that is used to connect and execute query to the database.JDBC API uses JDBC drivers to connects to the database.

Que: What is JDBC Driver ?

Ans:JDBC Driver is a software component that enables java application to interact with the database.

There are 4 types of JDBC drivers:

1. JDBC-ODBC bridge driver
2. Native-API driver (partially java driver)
3. Network Protocol driver (fully java driver)
4. Thin driver (fully java driver)(mostly used driver)

Que: What are the steps to connect to the database in java ?

Ans: Register the driver class(JDBC driver)
Create connection
Create statement
Execute query
Close connection

Que: What is the difference between Statement and PreparedStatement interface ?

Ans: In case of Statement, query is complied each time whereas in case of PreparedStatement, query is complied only once and data is store in cache to use further. So performance of PreparedStatement is better than Statement.

Que: How can we execute stored procedures and functions ?

Ans: CallableStatement interface is used to execute procedures and funtions in java.

Que: How can we store and retrieve images from the database ?

Ans:  PreparedStaement interface is used to store and retrieve images in java.

Que: What is a JavaBean ?

Ans: JavaBean is a reusable software components that is used in Java programming language, it provide the structure to reuse the java code in multiple places in project.

Que: What is Locale Class ?

Ans: A Locale Class contains methods and constructors to fetch specific geographical, political, or cultural region information.

Que: What are wrapper classes ?

Ans: Wrapper classes are classes that allow primitive data types to be accessed as objects.
For Example: Integer, Long, Double etc classes are Wrapper classes.

Que:What is the use of System class ?

Ans: System class is to used to  access system resources.

Que: What is singleton class ?

Ans: Singleton class means that at any given time only one instance of the class is present, in one JVM.

Que: What is an applet ?

Ans: An applet is a small java program that runs inside in browser and generates dynamic contents.


Core Java Intervirews Questions Part Three

This post contains interviews questions regading String Handling, Exception Handling,
Multithreading,Synchronization,Nested Class and Interface.

Que: What is the meaning of immutable in terms of String class ?

Ans: The simple meaning of immutable is unmodifiable or unchangeable. Once string object has been created, its value can't be changed.To see more click on   String Handling

Que: Why String objects are immutable in java ?

Ans: Because java uses the concept of string literal. Suppose there are 10 reference variables,all referes to one object "vishwa".If one reference variable changes the value of this object,it will be affected to all the reference variables. That is why string objects are immutable in java.To see more click on   String Handling

Que: How many ways we can create the String object ?

Ans: There are two ways to create the string object, by string literal and by new keywod.
To see more click on    String Handling

Que: Wow many objects will be created in the following code ?
String name="java";
String name="java";
String name="java";
String name="java";

Ans: Only one object.To see more click on String Handling

Que: Why java uses the concept of string literal ?

Ans: To make Java more memory efficient (because no new objects are created if it exists already in String constant pool area).

Que: How many objects will be created in the following code ?
String name=new String("java");

Ans: Two objects, one in String constant pool and other in non-pool(heap).

Que: How can we create immutable class in java ?

Ans: We can create immutable class as the String class by defining any class as final.

Que: What is the basic difference between String and Stringbuffer object ?

Ans: String is an immutable object. StringBuffer is a mutable object.

Que: What is the difference between StringBuffer and StringBuilder ?

Ans: StringBuffer is synchronized whereas StringBuilder is not synchronized.

Que: What is the purpose of toString() method in java ?

Ans: The toString() method returns the String representation of any object. If you print any object, java compiler internally invokes the toString() method on that object. So overriding the toString() method, returns the desired output, it can be the state of an object etc. depends on your implementation.


Que: What is Exception Handling ?

Ans: Exception Handling is a mechanism to handle runtime errors.It is mainly used to handle checked exceptions.

Que: What is difference between Checked Exception and Unchecked Exception ?

Ans: 

Checked Exception:

The classes that extend Throwable class except RuntimeException and Error are known as checked
exceptions e.g.ServletException,IOException,SQLException etc. Checked exceptions are checked at compile-time.

Unchecked Exceptions:

The classes that extend RuntimeException are known as unchecked exceptions e.g.ArrayIndexOutOfBoundExceptionArithmeticException,NumberFormatException,
NullPointerException etc. Unchecked exceptions are not checked at compile-time.

Que: What is the base class(parent class) for Error and Exception ?

Ans: Throwable class.

Que: Is it necessary that each try block must be followed by a catch block ?

Ans: It is not necessary that each try block must be followed by a catch block. It should be followed by either a catch block OR a finally block.

Que: What is finally block ?

Ans: finally block is a block that is always executed either exception occured or not.

Que: Can finally block be used without catch ?

Ans: Yes, by try block. finally must be followed by either try or catch block.

Que: Is there any case when finally will not be executed ?

Ans: finally block will not be executed if program exits(either by calling System.exit() method or by causing a fatal error that causes the process to abort).

Que: What is difference between throw and throws ?

Ans:          Throw                                                             Throws
1)throw is used to explicitly throw an exception.        hrows is used to declare an exception.
2)checked exceptions can not be propagated with      checked exception can be propagated                           throw only.                                                          with throws.
3)throw is followed by an instance.                            throws is followed by class.
4)throw is used within the method.                             throws is used with the method signature.           5)You cannot throw multiple exception.                   You can declare multiple exception e.g.
                                                             public void method()throws IOException,SQLException.                  


Que:  Can an exception be rethrown ?

Ans: Yes.

Que: Can subclass overriding method declare an exception if parent class method doesn't
throw an exception ?

Ans: Yes but only unchecked exception not checked.

Que: What is exception propagation ?

Ans: Forwarding the exception object to the invoking method is known as exception propagation.

Que: What is nested class ?

Ans: A class which is declared inside another class is known as nested class. There are 4 types of nested class member inner class, local inner class, annonymous inner class and static nested class.

Que: Is there any difference between nested classes and inner classes ?

Ans: Yes ofcourse inner classes are non-static nested classes i.e. inner classes are the part of nested classes. to see more click on Nested Classes

Que: Can we access the non-final local variable, inside the local inner class ?

Ans: No, local variable must be constant if you want to access it in local inner class.

Que: What is nested interface ?

Ans: Any interface i.e. declared inside the interface or class, is known as nested interface. It is static by default.

Que: Can a class have an interface ?

Ans: Yes, it is known as nested interface.

Que: Can an Interface have a class ?

Ans: Yes, they are static implicitely.

Que: What is multithreading ?

Ans: Multithreading is a process of executing multiple threads simultaneously.Its main advantage is:
Threads share the same address space.
Thread is lightweight.
Cost of communication between process is low.

Que: What is thread ?

Ans: A thread is a lightweight subprocess.It is a separate path of execution.It is called separate path of execution because each thread runs in a separate stack frame.

Que: What is the difference between preemptive scheduling and time slicing ?

Ans: Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.

Que: What does join() method ?

Ans: The join() method waits for a thread to die. In other words, it causes the currently running threads to stop executing until the thread it joins with completes its task.

Que: Is it possible to start a thread twice ?

Ans: No, there is no possibility to start a thread twice. If we does,it throws an exception as IllegalThreadStateException.

Que: Can we call the run() method instead of start() ?

Ans: yes, but it will not work as a thread rather it will work as a normal object so there will not be contextswitching between the threads.

Que: What about the daemon threads ?

Ans: The daemon threads are basically the low priority threads that provides the background support to the user threads. It provides services to the user threads.

Que: Can we make the user thread as daemon thread if thread is started ?

Ans: No, if you do so, it will throw IllegalThreadStateException.

Que: What is difference between wait() and sleep() method ?

Ans:                    wiat()                                                             sleep()          
1)The wait() method is defined in Object class. The sleep() method is defined in Thread class.
2) wait() method releases the lock.                    The sleep() method doesn't releases the lock.

Que: What is shutdown hook ?

Ans: The shutdown hook is basically a thread i.e. invoked implicitely before JVM shuts down. So we can use it perform clean up resource.

Que: When should we interrupt a thread ?

Ans: We should interrupt a thread if we want to break out the sleep or wait state of a thread.

Que: What is the difference between notify() and notifyAll() ?

Ans: notify() is used to unblock one waiting thread whereas notifyAll() method is used to unblock all the threads in waiting state.

Que: What is deadlock ?

Ans: Deadlock is a situation when two threads are waiting on each other to release a resource. Each thread waiting for a resource which is held by the other waiting thread.

Que: What is synchronization ?

Ans: Synchronization is the capabilility of control the access of multiple threads to any shared resource.It is used:
1. To prevent thread interference.
2. To prevent consistency problem.
 
Que: What is the purpose of Synchnorized block ?

Ans: Synchronized block is used to lock an object for any shared resource. Scope of synchronized block is smaller than the method.

Que: Can Java object be locked down for exclusive use by a given thread ?

Ans: Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it.

Que: What is static synchronization ?

Ans: If you make any static method as synchronized, the lock will be on the class not on object.




Saturday, 20 December 2014

Core Java Inerviews Questions Part Two

Que: What is abstraction ?

Ans: Abstraction is a process of hiding the implementation details and showing only functionality to the user. Abstraction lets you focus on what the object does instead of how it does it.To see more click on   Abstraction

Que: What is the difference between abstraction and encapsulation ?

Ans: Abstraction hides the implementation details whereas encapsulation hides the data.
Abstraction lets you focus on what the object does instead of how it does it.

Que: What is abstract class ?

Ans: A class that is declared as abstract is known as abstract class.It needs to be extended and its method implemented.It cannot be instantiated. To see more click on   Abnstraction

Que: Can there be any abstract method without abstract class ?

Ans: No, if there is any abstract method in a class, that class must be abstract.

Que: Can you use abstract and final both with a method ? 

Ans: No, because abstract method needs to be overridden whereas you can't override final method.

Que: Is it possible to instantiate the abstract class ?

Ans: No, abstract class can never be instantiated.

Que: What is Runtime Polymorphism ?

Ans: Runtime polymorphism or dynamic method dispatch is a process in which a call to an overridden method is resolved at runtime rather than at compile-time. In this process,an overridden method is called through the reference variable of a superclass. The determination of the method to be called is based on the object being referred to by the reference variable.
To see more click on   Runtime Polymorphism

Que: Can you achieve Runtime Polymorphism by data members ?

Ans: No.  To see more click on    Runtime Polymorphism

Que: What is the difference between static binding and dynamic binding ?

Ans: In case of static binding type of object is determined at compile time whereas in dynamic binding type of object is determined at runtime.To see more click on  Static and Dynamic Binding

Que: What is interface ?

Ans: Interface is a blueprint of a class that have static constants and abstract methods.It can be used to achive fully abstraction and multiple inheritance.To see more click on   Interface

Que: Can you declare an interface method static ?

Ans: No, because methods of an interface is abstract bydefault, and static and abstract keywords can't be used together.

Que: Can an Interface be final ?

Ans:  No, because its implementation is provided by another class.

Que: What is marker interface ?

Ans: An interface that have no data member and method is known as a marker interface.For example
Serializable,Cloneable etc.

Que: What is difference between abstract class and interface ?

Ans:  
          Abstarct Class                       Interface
1)An abstract class can have method body. Interface have only abstract methods.
2)An abstract class can have instance variables.An interface cannot have instance variables.
3)An abstract class can have constructor. Interface cannot have constructor.
4)An abstract class can have static methods. Interface cannot have static methods.
5)You can extends one abstract class. You can implement multiple interfaces.



Que: )Can we define private and protected modifiers for variables in interfaces ?

Ans: No, they are implicitely public.

Que: When can an object reference be cast to an interface reference ?

Ans: An object reference can be cast to an interface reference when the object implements the referenced interface.

Que: What is package ?

Ans: A package is a group of similar type of classes interfaces and subpackages. It provides access protection and removes naming collision.To see more click on   Package 

Que: Do I need to import java.lang package every time ?

Ans:  No. It is by default loaded internally by the JVM.

Que: Can I import same package/class twice ? Will the JVM load the package twice at runtime ?

Ans: One can import the same package or same class multiple times. Neither compiler nor JVM complains about it.But the JVM will internally load the class only once no matter how many times you import the same class.

Que: What is static import ?

Ans: By static import, we can access the static members of a class directly, there is no to qualify it with the class name.To see more click on   static import

Top Core Java Interviews Questions Part One

This post contains series of  frequently asked core java questions.

Que: What is Java ?

Ans: Java is Object Oriented Programing language and it follow OOPs concepts. java orignally developed by Sun Microsystem Company but now it is product of Oracle Corporation. To see more click on  Features of Java

Que: What is OOPs concepts ?

Ans: OOPs stands for Object Oriented Programming Standard.Under OOPs comes different
concepts like Object,Class,Inheritance,Encapsulation,Polymorphism and Abstraction.
To see more click on  OOPs concepts


Que: What is the main difference between Java platform and other platforms ?

Ans:The Java platform differs from  other platforms in the sense that it's a software-based platform that runs on top of other hardware-based platforms(OS).It has two components:
1. Runtime Environment
2. API(Application Programming Interface)

Que: What is platform?

Ans: A platform is basically the hardware or software environment in which a program runs.There are two types of platforms software-based and hardware-based.Java is a software-based platform.

Que: What is difference between JDK,JRE and JVM ?

Ans:  JVM(Java Virtual Machine)

JVM is an acronym of Java Virtual Machine,it is an abstract machine which provides the runtime
environment in which java bytecode can be executed.
JVMs are available for many hardware and software platforms (so JVM is plateform dependent).

JRE(Java Runtime Environment)

JRE stands for Java Runtime Environment. It is the implementation of JVM and it provide environment to run byte code and physically exists.

JDK(Java Development Kit)

JDK is an acronym of Java Development Kit. It physically exists. It contains JRE + development tools(javac,javap).
To see more click on  What is JVM, JRE, JDK

Que: What is byte code in Java ?

Ans: Byte code is binary code(machine code) compile by java compiler so that byte code run on any OS plateform. Byte code is  responsible for Java is Platform Independent language.

Que: How many types of memory areas are allocated by JVM ?

Ans: Five(5) types:
1. Class(Method) Area
2. Heap
3. Stack
4. Program Counter Register
5. Native Method Stack

To see more click on   JVM

Que: What is JIT compiler ?

Ans: Just-In-Time(JIT) compiler:It is used to improve the performance.JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation.Here the term “compiler” refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.

Que: Why Java known as 'write once and run anywhere' programming ?

Ans: Because Java compiled the code into byte code which is the intermediate language between source code and machine code. This byte code is not platorm specific and hence can be run on any platform.

Que: What is classloader ?

Ans: 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.

Que: Can you run java program with blank name (.java) file name ?

Ans: Yes, save your java file by .java only, compile it by javac .java and run by java yourclassname.

For example:

Save as  .java only.

class Test{
public static void main(String []args){
System.out.println("Welcome Java World");
 }
}

To compile:>javac .java
To run    :>java Test(class name)

Que:What if I write static public void instead of public static void ?

Ans: Program compiles and runs properly.

Que: What is the default value of the local variables ?

Ans: The local variables are not initialized to any default value, neither primitives nor object references.

Que: What will be the initial value of an object reference which is defined as an instance variable ?

Ans: The object references are all initialized to null in Java.

Que:What is constructor ?

Ans: Constructor is just like a method that is used to initialize the state of an object. It is invoked at the time of object creation.To see more click on  Constuctor

Que: What is the purpose of default constructor ?

Ans: The default constructor provides the default values to the objects. The java compiler creates a default constructor only if there is no constructor in the class.

Que: Does constructor return any value ?

Ans: Yes, that is current instance(Object) but you cannot use return type yet it returns a value.

Que: Can  constructor inherited ?

Ans: No, constructor is not inherited.

Que: What is static block ?

Ans: Is used to initialize the static data member.
It is excuted before main method at the time of classloading.

Que: What is static variable ?

Ans: static variable is used to refer the common property of all objects (that is not unique for each object) e.g. company name of employees,college name of students etc.
static variable gets memory only once in class area at the time of class loading.

Que: What is static method ?

Ans: because object is not required to call static method if It were non-static method,jvm creats object first then call main() method that will lead to the problem of extra memory allocation.
To see more click on   static keyword

Que: Can we execute a program without main() method ?

Ans: Yes,by static block we can run program. To see more click on  static keyword

Que: What if the static modifier is removed from the signature of the main method ?

Ans: Program compiles. But at runtime throws an error "NoSuchMethodError".

Que: What is this in java ?

Ans: It is a keyword that that refers to the current object.To see more click on  this keyword

Que: What is Inheritance ?

Ans: Inheritance is a mechanism in which one object acquires all the properties and behaviour of another object of another class. It represents IS-A relationship.It is used for Code Resusability and Method Overriding.
To see more click on  Inheritance

Que: Which class is the superclass for every class.

Ans: Object class.Defined under java.lang package

Que: Why multiple inheritance is not supported in java ?

Ans: To reduce the complexity and simplify the language,multiple inheritance is not supported in java in case of class.To see more click on  Inheritance

Que: What is composition ?

Ans: Holding the reference of the other class within some other class is known as composition.

Que: What is difference between aggregation and composition ?

Ans: Aggregation represents weak relationship whereas composition represents strong relationship.
For example:
Car has an indicator (aggregation) but Car has an engine (compostion).


Que: Why Java does not support pointers ?

Ans: Pointer is a variable that refers to the memory address. They are not used in java because they are unsafe(unsecured) and complex to understand.

Que: What is super in java ?

Ans: It is a keyword that refers to the immediate parent class object.To see more click on
super keyword

Que: Can you use this() and super() both in a constructor ?

Ans: No. Because super() or this() must be the first statement.

Que: What is method overriding ?

Ans: If a subclass provides a specific implementation of a method that is already provided by its parent class,it is known as Method Overriding.It is used for runtime polymorphism and to provide the specific implementation of the method.To see more click on  method overriding

Que: Can we override static method ? 

Ans: No, you can't override the static method because they are the part of class not object.

Que: Why we cannot override static method ?

Ans: It is because the static method is the part of class and it is bound with class whereas instance method is bound with object and static gets memory in class area and instance gets memory in heap.

Que: Can we override the overloaded method ?

Ans: Yes.

Que: What is object cloning ?

Ans: The object cloning is used to create the exact copy of an object.To see more click on
object cloning

Que: What is method overloading ?

Ans: If a class have multiple methods by same name but different parameters, it is known as Method
Overloading. It increases the readability of the program.To see more click on method overloading

Que: Why method overloading is not possible by changing the return type in java ?

Ans: Because of code ambiguity(compile time error).To see more click on  method overloading

Que: Can we overload main() method ?

Ans: Yes, ofcourse! You can have many main() methods in a class by overloading the main method.
To see more click on   method overloading

Que: What is covariant return type ?

Ans: Now, since java5, it is possible to override any method by changing the return type if the return type of the subclass overriding method is subclass type. It is known as covariant return type.

Que Can you declare the main method as final ?

Ans: Yes, such as, public static final void main(String []args){}.

Que: What is final variable ?

Ans: If you make any variable as final, you cannot change the value of final variable(It will be
constant).To see more click on  final keyword

Que: What is final method ?

Ans: Final methods can't be overriden.To see more click on  final keyword

Que: What is final class ?

Ans: Final class can't be inherited.To see more click on  final keyword

Que: What is blank final variable ?

Ans: A final variable, not initalized at the time of declaration,is known as blank final variable.
To see more click on   final keyword

Que: Can we intialize blank final variable ?

Ans: Yes, only in constructor if it is non-static. If it is static blank final variable, it can be initialized only in the static block.To see more click on   final keyword