216. What is a package?
Ans. A package is a collection of classes and interfaces that provides a high-level
layer of access protection and name space management.
217. What is a reflection package?
Ans. java. lang. reflect package has the ability to analyze itself in runtime.
218. What is interface and its use?- Interface is similar to a class which may
contain method’s signature only but not bodies and it is a formal set of method and
constant declarations that must be defined by the class that implements it.
Interfaces are useful for: a)Declaring methods that one or more classes are
expected to implement b)Capturing similarities between unrelated classes without
forcing a class relationship. c)Determining an object’s programming interface
without revealing the actual body of the class.
219. What is an abstract class?- An abstract class is a class designed with
implementation gaps for subclasses to fill in and is deliberately incomplete.
220. What is the difference between Integer and int?- a) Integer is a class
defined in the java. lang package, whereas int is a primitive data type defined in
the Java language itself. Java does not automatically convert from one to the
other. b) Integer can be used as an argument for a method that requires an object,
whereas int can be used for calculations.
Saturday, May 10, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment