What is the difference between this() and super()?
- this() can be used to invoke aconstructor of the same class whereas super() can be used to invoke a super classconstructor.23.
What is the difference between superclass and subclass?
- A super class is a class thatis inherited whereas sub class is a class that does the inheriting.24.
What modifiers may be used with top-level class?
- public, abstract and final can beused for top-level class.25.
What are inner class and anonymous class?
- Inner class : classes defined in otherclasses, including those defined in methods are called inner classes. An inner class canhave any accessibility including private. Anonymous class : Anonymous class is a classdefined inside a method without a name and is instantiated and declared in the same placeand cannot have explicit constructors.26.
What is a package?
- A package is a collection of classes and interfaces that provides ahigh-level layer of access protection and name space management.27.
What is a reflection package?
- java. lang. reflect package has the ability to analyzeitself in runtime.28.
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)Capturingsimilarities between unrelated classes without forcing a class relationship. c)Determining
an object’s programming interface without revealing the actual body of the class.
What is an abstract class?
- An abstract class is a class designed with implementationgaps for subclasses to fill in and is deliberately incomplete.30.
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 languageitself. Java does not automatically convert from one to the other. b) Integer can be used asan argument for a method that requires an object, whereas int can be used forcalculations.31.
What is a cloneable interface and how many methods does it contain?
- It is nothaving any method because it is a TAGGED or MARKER interface.32.
What is the difference between abstract class and interface?
- a) All the methodsdeclared inside an interface are abstract whereas abstract class must have at least oneabstract method and others may be concrete or abstract. b) In abstract class, key wordabstract must be used for the methods whereas interface we need not use that keyword forthe methods. c) Abstract class must have sub
classes whereas interface can’t have
Can you have an inner class inside a method and what variables can you access?
-Yes, we can have an inner class inside a method and final variables can be accessed.34.
What is the difference between String and String Buffer?
- a) String objects areconstants and immutable whereas StringBuffer objects are not. b) String class supportsconstant strings whereas StringBuffer class supports growable and modifiable strings.35.
What is the difference between Array and vector?
- Array is a set of related data typeand static whereas vector is a growable array of objects and dynamic.36.
What is the difference between exception and error?
- The exception class definesmild error conditions that your program encounters. Exceptions can occur when trying to