© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu

Home Placements Interview Questions Java Interview Questions And Answers Java Interview Questions On Classes, Objects and Access Specifiers ▼

Java Interview Questions On Classes, Objects and Access Specifiers

12. How final keyword works in java ?

Answer:

Given to

  • Classes
  • Methods
  • Variables
  • Inner classes.

Notes:

  • A final modifier makes the value of a primitive as a constant, with an object reference variable the reference variable makes it as constant. This means you can't re-assign the same reference variable to point another object.
  • A final variable must be initialized at the time of declaration.
  • If a class is declared as final then all the methods inside the class are implicitly final. So the final methods may not be overrided.
  • The class cannot be subclassed if defined as final class, this avoids the inheritance.

13. How java abstract modifier behaves?

Answer
Given to

Classes
Methods

  • An abstract class can't be instantiated i.e. you may not make a new call on it. In an ordinary class, if one method is declared as abstract, then the class must be declared as abstract.
  • The abstract class contains only method signatures without body of the method, the body lies in the subclass. (A subclass must provide the implementation).
  • The same thing applies, when you implement an interface, it insists to provide method implementation.

14. Explain About 'native' Modifier?

Answer:
Given to
Methods.
Native methods are used in Java programs to load Non Java programs written C/C++ and etc..

Next
1 2 3 4 5 6 7 8
SLogix Student Projects
bottom