The static import construct allows unqualified access to static members without inheriting from the type that contains those static members. Static imports can be performed for individual members or for a group of members.
The filed members in an interface are implicitly public, final, and static. Interface methods cannot be native, static, synchronized, final, private, and protected. They are implicitly public, abstract, and non-static.
a. cannot be instantiated.
b. have one or more constructors.
c. may or may not have abstract methods.
d. may or may not have non-abstract methods.
A concrete (non-abstract) class implementing an interface has to implement all the methods declared in the interface. A concrete class extending an abstract class must define all the abstract methods defined in the latter.
When an array is created, all its elements are initialized to their default values, even if the array is declared locally. Static and instance variables of a class are also initialized with a default value. Local variables are never given a default value; they have to be explicitly initialized before use.
Variable arguments (varargs) allow you to specify a method that can take multiple arguments of the same type and does not require that the number of arguments be predetermined.
For example, we can invoke
Computer myComp=new Computer("HCL", "Celeron Model xxx");
even if the only constructor defined in the class is
Static methods and static variables of a class can be used without having any instances of that class at all. A static method cannot access non-static variables of the class. Static methods cannot be redefined as non-static in subclasses, and vice versa.
To get the array size, use the array instance variable called length. Arrays are indexed beginning with zero and end with length-1. Whenever you attempt to access an index value outside the range 0 to n-1, an ArrayIndexOutOfBoundsException is thrown.
The return type of an overriding method should match that of the overridden method except in the case of covariant returns, as discussed in the next point. Return types of overloaded methods can be different, but changing only the return type is not legal. The arguments should also be different.
A method that declares a class as a return type can return any object which is of the subclass type. A method that declares an interface as a return type can return any object whose class implements that interface.
inner class name alone to instantiate it:
MyInner myInner = new MyInner();
From outside the outer instance code, the inner class name must be included in the outer instance:
This action might not be possible to undo. Are you sure you want to continue?