A class can't be declared as protected. only methods can be declared as protected.
All IT and Non IT Interview Questions, MCQs, Online Quiz Questions, Engineering VIVA Questions
Home » All posts
Sunday, 12 February 2012
Which package is imported by default?
java.lang package is imported by default even without a package declaration.
What is a package?
Package is a collection of related classes and interfaces. package declaration should be first statement in a java class.
Can a source file contain more than one Class declaration?
Yes a single source file can contain any number of Class declarations but only one of the class can be declared as public.
Does the order of public and static declaration matter in main method?
No it doesn't matter but void should always come before main().
Can a main method be declared final?
Yes. Any inheriting class will not be able to have it's own default main method.
Subscribe to:
Comments (Atom)