Static variable is a data member declared with the static keyword which is then shared by every instance of the class. Instance variables are the object declared with the class name which are different from each other.
It is recommended not to declare any data members in the interfaces but if any data members are declared, they are, by default, public, static and final. Due to which instance variables are not to be declared for interfaces.
A Java class can have more than one constructor and these multiple declarations of the constructors is called as constructor overloading. Every declared constructor has different parameter list for different purposes.
A catch block is not necessarily needed for a try block unless the error which is thrown is to be handled inside the same module in which try block is declared.
A Java inner class is similar to an object declared as data member of other class. Just like, any other data members and methods which can access all other methods and data members of the same class, inner class can access instance fields of the outer class.
In java programs, finally clause is not for the comments but is for the block of code which is to execute the important code. Comments in java programs are denoted by // or /*…..*/
Lambda expression is not only for expression. It is to represent an anonymous function. It is declared using the lambda operator (->).
In java, sub class can extend only one superclass as it doesn’t support multiple inheritance but can implement many interfaces by implementing all the methods of the interfaces.
To remove the successive two adjacent elements, the remove method can be used referring the index number of the iterator. It will remove the element from the iterator and will return the same to the calling method.
Java abstract class can contain implemented and abstract methods but there must be at least one abstract method declared in the class. If there is no abstract method, then the class cannot be declared as abstract class.
Restrictions and limititations for Java Genrics are:
Arguments cannot be instantiated with primitive types.
Runtime inquiry can not be used.
instances cannot be thrown or catched.
Type variables cannot be instatiated.
type erasure is a compile time process which is used to remove all the explicit type annotations from the program.
Wild card type (?) in java is a parameter of special type which is used to denote the use of the generic types in the parameters.