Core Java - Interview Questions and Answers for 'Code reuse' - 2 question(s) found - Order By Newest Must know at all levels. Among Top 10 frequently asked questions in Java. Very frequently asked to fresh graduates or less experienced professionals. Ans. Its a facility for code reuse and independent extension wherein a derived class inherits the properties of parent class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  inheritance  object oriented programming (oops)  oops concepts  oops concepts  java concepts  code reuse  code re-use   classes  derived classes Asked in 14 Companies basic   frequent Related Questions Why do we need Inner classes ? Cant we just work with outer classes wherever we implement Inner classes ? Differences between abstract class and interface ? What are different types of classes ? Will this code give error if i try to add two heterogeneous elements in the arraylist. ? and Why ? Which of the following can be marked static ?
a. Methods , Variables and Initialization Blocks.
b. Methods , Variables , Initialization Blocks and Outer Classes and nested Classes.
c. Methods , Variables , Initialization Blocks and Outer Classes.
d. Methods , Variables , Initialization Blocks and nested Classes What is the difference between the following two code lines ?
1. new OuterClass().new InnerClass();
2. new OuterClass.InnerClass(); What are the Wrapper classes available for primitive types ? What are wrapper classes ? Why Struts 1 Classes are not Thread Safe whereas Struts 2 classes are thread safe ? What is a stream and what are the types of Streams and classes of the Streams? Q2. What are the ways to Reuse Code in Java ? Core Java
Ans. 1. Object Level Reuse - private methods
2. Class Level Reuse - static methods
3. package level Reuse - default methods
4. Application Level Reuse - Classes
5. Multiple Applications Level Reuse - Libraries , Frameworks Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Code Reuse