Our website is made possible by displaying online advertisements to our visitors.Please consider supporting us by disabling your ad blocker.
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Translate it in your own Language

Print this Job Post

Print Friendly and PDF

Tuesday, May 27, 2014

Core Java – OOPs Concepts : Abstraction Interview Questions

Question-56:What is abstraction?
Abstraction is a process of hiding the implementation details and showing only functionality to the user. Abstraction lets you focus on what the object does instead of how it does it.

Question-57: What is the difference between abstraction and encapsulation?
Abstraction hides the implementation details whereas encapsulation hides the data. Abstraction lets you focus on what the object does instead of how it does it.

Question-58: What is abstract class?
A class that is declared as abstract is known as abstract class.It needs to be extended and its method implemented.It cannot be instantiated.

Question-69: Can there be any abstract method without abstract class?
No, if there is any abstract method in a class, that class must be abstract.

Question-60: Can you use abstract and final both with a method?

No, because abstract method needs to be overridden whereas you can’t override final method.

Question-61: Is it possible to instantiate the abstract class?
No, abstract class can never be instantiated.

Question-62: What is interface?
Interface is a blueprint of a class that have static constants and abstract methods.It can be used to achive fully abstraction and multiple inheritance.

Question-63: Can you declare an interface method static?
No, because methods of an interface is abstract by default, and static and abstract keywords can’t be used together.

Question-64: Can an Interface be final?
No, because its implementation is provided by another class.

Question-65: What is marker interface?
An interface that have no data member and method is known as a marker interface.For example Serializable,Cloneable etc.

Question-66: What is difference between abstract class and interface?

  1. An abstract class can have method body (non-abstract methods). Interface have only abstract methods.
  2. An abstract class can have instance variables. An interface cannot have instance variables. 
  3. An abstract class can have constructor. Interface cannot have constructor.
  4. An abstract class can have static methods. Interface cannot have static methods. 
  5. You can extends one abstract class. You can implement multiple interfaces.

Question-67:Can we define private and protected modifiers for variables in interfaces?
No, they are implicitly public.

Question-68: When can an object reference be cast to an interface reference?
An object reference can be cast to an interface reference when the object implements the referenced interface.

Core Java – OOPs Concepts : Package Interview Questions

No comments:

Post a Comment

Copyright @ CrackMNC 2014-2024
Divas Nikhra Theme by Crack MNC