Generic classes encapsulate operations that are not specific to a particular data type. The most common use for generic classes is with collections like linked lists, hash tables, stacks, queues, trees and so on where operations such as adding and removing items from the collection are performed in much the same way regardless of the type of data being stored.
Object -Interview Questions
Object concepts
Q: What is an object in Java?
A: In Java the Object class is the ultimate superclass of every other object type. All objects are extended from the Object class, either directly or by inheritance through any number of parent classes. If a class does not explicitly extend any named class, it implicitly extends the Object class. An object with a small o is the word used to describe an instance of a Java class.
Q: What is an object in Java?
A: In Java the Object class is the ultimate superclass of every other object type. All objects are extended from the Object class, either directly or by inheritance through any number of parent classes. If a class does not explicitly extend any named class, it implicitly extends the Object class. An object with a small o is the word used to describe an instance of a Java class.
MODIFIERS -INTERVIEW QUESTIONS
Q: How can I prevent inheritance without marking a class final?
A: Declaring a class final is the simplest way to prevent extension. A more limited way to control overrides without preventing extension is to declare individual methods final. If all methods are declared final but not the class, the class may be extended but none of its methods overridden.
A: Declaring a class final is the simplest way to prevent extension. A more limited way to control overrides without preventing extension is to declare individual methods final. If all methods are declared final but not the class, the class may be extended but none of its methods overridden.
Labels:
C# interview Questions
Subscribe to:
Comments (Atom)