Advantages of Inheritance in java.

Answer Posted / kureshi salman

Inheritance means deriving a child class from a parent class
(i.e.existing class).
Use of inheritance iin java is we can reuse of a code.
For Ex.
class a
{
//variables.....
//methods.......
}
class b extends a
{
//variable of class a....
//methods of class a.....
//also
//variables and methods of class b
}
it means that we can inherit the class and features of
existing class in a new class.

Is This Answer Correct ?    29 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When should you use arraylist and when should you use linkedlist?

496


How do you use compareto in java?

561


What is the impact of declaring a method as final?

564


What are the differences between forwarding () method and sendredirect() methods?

623


Explain about OOPS concepts and fundamentals.

596






What is the functionality of the stub?

571


What is a class object?

500


What is garbage collection? What is the process that is responsible for doing that in java?

659


Which collection does not allow duplicates in java?

473


What is a method in java?

562


Explain about main thread in java?

615


For ease of programming you can consider the maze as a 2D array with colors represented by below integer and characters (in capital letters). • B - Black • W -White • G- Green • R- Red R B W B W W W W W W B W B B W W W W W W W B W B W W W B W W W W B B W W W B W W W B W W B B B B W B W B W W B W W W B W W W B B B W W B W W W B W W B W B W W W B W B W W W W B B W W W W B W W W W W G Shortest Route Problem: • Solution that finds the shortest Route between Red and Green  White will have 1 Weight.  Red and Green carry no weights.  Shortest path is the path with less weight when you add up the weights in the path.

1585


Why are parameters used in functions?

534


Can a class have multiple constructors?

537


Is nullpointerexception checked or unchecked?

558