|
1. Why do you prefer Java ? write once , run anywhere 2. In what ways do design patterns help build better software ? Design patterns helps software developers to reuse successful designs and architectures. It helps them to choose design alternatives that make a system reusuable and avoid alternatives that compromise reusability through proven techniques as design patterns. 3. What modifiers may be used with top-level class ? public, abstract and final can be used for top-level class. 4. What is a cloneable interface and how many methods does it contain ? It is not having any method because it is a TAGGED or MARKER interface. 5. What is finalize() method ? finalize () method is used just before an object is destroyed and can be called just prior to garbage collection. 6. Are servlets platform independent? If so Why? Also what is the most common application of servlets ? Yes, Because they are written in Java. The most common application of servlet is to access database and dynamically construct HTTP response 7. How is JavaBeans differ from Enterprise JavaBeans ? The JavaBeans architecture is meant to provide a format for general-purpose components. On the other hand, the Enterprise JavaBeans architecture provides a format for highly specialized business logic components. 8. 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. 9. What are Transient and Volatile Modifiers ? Transient : The transient modifier applies to variables only and it is not stored as part of its object’s Persistent state. Transient variables are not serialized. Volatile : Volatile modifier applies to variables only and it tells the compiler that the variable modified by volatile can be changed unexpectedly by other parts of the program. 10. What is the difference between abstract class and interface ? a) All the methods declared inside an interface are abstract whereas abstract class must have at least one abstract method and others may be concrete or abstract. b) In abstract class, key word abstract must be used for the methods whereas interface we need not use that keyword for the methods. c) Abstract class must have subclasses whereas interface can’t have subclasses.
|