Can we override static method?
No, we can't override the static method because they are the part of class not object 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.
Can we override the overloaded method?
Yes.
Can we define private and protected modifiers for variables in interfaces?
No, they are implicitly public.
Static Import:
The static import feature of Java 5 facilitate the java programmer to access any static member of a class directly. There is no need to qualify it by the class name.
Advantage of static import:
Less coding is required if you have access any static member of a class oftenly.
Disadvantage of static import:
If you overuse the static import feature, it makes the program unreadable and unmaintainable.
All wrapper classes in java.lang are immutable, i.e. String, Integer, Boolean, Character, Byte, Short, Long, Float, Double, BigDecimal, BigInteger
0 comments: