Classes and Methods

50) Which are keywords in Java?


b) sizeof

c) friend

d) extends

e) synchronized

Ans : d and e

51) When must the main class and the file name coincide?

Ans :When class is declared public.

52) What are different modifiers?

Ans : public, private, protected, default, static, trancient, volatile, final, abstract.

53) What are access modifiers?

Ans : public, private, protected, default.

54) What is meant by “Passing by value” and ” Passing by reference”?

Ans : objects – pass by reference

Methods – pass by value

55) Is a class a subclass of itself?

Ans : A class is a subclass itself.

56) What modifiers may be used with top-level class?

Ans : public, abstract, final.

57) What is an example of polymorphism?

Inner class

Anonymous classes

Method overloading

Method overriding

Ans : c

Ref Link contributor :

Permanent link to Java Tutorials / Java Interview Questions: