What will be the default values of all the elements of an array defined as an instance variable?
If the array is an array of primitive types, then all the elements of the array will be initialized to the default value corresponding to that primitive type. e.g. All the elements of an array of int will be initialized to 0, while that of boolean type will be initialized to false. Whereas if the array is an array of references (of any type), all the elements will be initialized to null.
Why do threads block on I/O ?
Threads block on i/o (that is enters the waiting state) so that other threads may execute while the i/o Operation is performed.
What is the difference between superclass and subclass?
A super class is a class that is inherited whereas sub class is a class that does the inheriting.
What is difference between overloading and overriding?
a) In overloading, there is a relationship between methods available in the same class whereas in overriding, there is relationship between a superclass method and subclass method.
b) Overloading does not block inheritance from the superclass whereas overriding blocks inheritance from the superclass.
c) In overloading, separate methods share the same name whereas in overriding, subclass method replaces the superclass.
d) Overloading must have different method signatures whereas overriding must have same signature.
What is method overloading and method overriding?
Method Overloading: When a method in a class having the same method name with different arguments is said to be method overloading.
Method Overriding: When a method in a class having the same method name with same arguments is said to be method overriding