|
1. What is the difference between String and String Buffer ? a) String objects are constants and immutable whereas StringBuffer objects are not. b) String class supports constant strings whereas StringBuffer class supports growable and modifiable strings. 2. What is difference between overloading and overriding ? a) In overloading, there is a relationship between methods available in the same class whereas in overriding, there is relationship between a superclass method and subclass method. b) Overloading does not block inheritance from the superclass whereas overriding blocks inheritance from the superclass. c) In overloading, separate methods share the same name whereas in overriding, subclass method replaces the superclass. d) Overloading must have different method signatures whereas overriding must have same signature. 3. Awt stands for ? and what is it ? AWT stands for Abstract window tool kit. It is a is a package that provides an integrated set of classes to manage user interface components. 4. What is the difference between superclass and subclass ? A super class is a class that is inherited whereas sub class is a class that does the inheriting. 5. What are inner class and anonymous class ? Inner class : classes defined in other classes, including those defined in methods are called inner classes. An inner class can have any accessibility including private. Anonymous class : Anonymous class is a class defined inside a method without a name and is instantiated and declared in the same place and cannot have explicit constructors. 6. Describe 3-Tier Architecture in enterprise application development In 3-tier architecture, an application is broken up into 3 separate logical layers, each with a well-defined set of interfaces. The presentation layer typically consists of a graphical user interfaces. The business layer consists of the application or business logic, and the data layer contains the data that is needed for the application. 7. 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. 8. What is meant by Inheritance and what are its advantages ? Inheritance is the process of inheriting all the features from a class. The advantages of inheritance are reusability of code and accessibility of variables and methods of the super class by subclasses. 9. What is the difference between this() and super() ? this() can be used to invoke a constructor of the same class whereas super() can be used to invoke a super class constructor. 10. 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. 11. What is a reflection package ? java. lang. reflect package has the ability to analyze itself in runtime. 12. What is Garbage Collection and how to call it explicitly ? When an object is no longer referred to by any variable, java automatically reclaims memory used by that object. This is known as garbage collection. System. gc() method may be used to call it explicitly.
|