Question-31. Why we cannot override static method ?
Answer- 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.
Question-32. Can we override the overloaded method ?
Answer- Yes.
Question-33. Can you have virtual functions in Java ?
Answer- Yes, all functions in Java are virtual by default.
Question-34. What is covariant return type ?
Answer- 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.
Question-35. What is final variable ?
Answer- If you make any variable as final, you cannot change the value of final variable(It will be constant).
Question-36. What is final method ?
Answer- Final methods can’t be overridden.
Question-37. What is final class ?
Answer- Final class can’t be inherited.
Question-38. What is blank final variable ?
Answer- A final variable, not initalized at the time of declaration, is known as blank final variable.
Question-39. Can we intialize blank final variable ?
Answer- 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.
Question-40. Can you declare the main method as final ?
Answer- Yes, such as, public static final void main(String[] args){}.