facebook

Java

1.What is the base class of all classes?

— java.lang.Object

2.Does Java support multiple inheritance?

—  Java doesn’t support multiple inheritance.

3.Is Java a pure object oriented language?

— Java uses primitive data types and hence is not a pure object oriented language.

4.Are arrays primitive data types?

— In Java, Arrays are objects.

5.What is the return type of the main() method?

— Main() method doesn’t return anything hence declared void.

6.Why is the main() method declared static?

main() method is called by the JVM even before the instantiation of the class hence it is declared as static.

7.What is the arguement of main() method?

— main() method accepts an array of String object as argument.

8.Can a main() method be overloaded?

— Yes. You can have any number of main() methods with different method signature and implementation in the class.

9.Can a main() method be declared final?

— Yes. Any inheriting class will not be able to have it’s own default main() method.

10.Does the order of public and static declaration matter in main() method?

— No. It doesn’t matter but void should always come before main().