I hope you are taking the piss with these answers?
hardik> Where did they come from? Hope they aren't homework.
Anyway, in the interests of correct information (please correct me if I
make any mistakes):
1) A java source file can contain How many public classes ? [All the
classes can be public]
A Java source file can contain only one public outer class, because the
names of public classes must match their source file names. However, it
can contain many public nested classes.
I wouldn't generally recommend putting "package private" classes in
sources files with a different name. OTOH, some hacks require an outer
class which only has to do with the implementation of one significant
class. For instance, initialising "transient" final variables of
serialisable classes (without using sun.misc.Unsafe).
2) What is default layout of Frame and Applet? [BorderLayout]
Even so I'd tend to set a layout explicitly. Just as well to be
explicit. And Panel defaults to a different layout manager (as does Box...).
3) References are always passed by ___ ? [Objects are always passed by
reference(address). Primitives are passed by Value]
References are always passed by value, technically. Everything is passed
by value. Objects are always referred to by references.
4) Which class doesn't call its super class constructor? [String str =
"abc";]
String str = "abc"; does not involve a constructor. It merely obtains a
reference to a preexisting constant object.
java.lang.Object does not call its super class constructor, because it
is the only class without a super class. OTOH, you could arrange for a
constructor to throw an exception before super is called, or do
something that does not exit at all.
Tom Hawtin