inheritance in java
class Arithmetic {
}
class Adder extends Arithmetic {
public int add(int a, int b)
{
return a+b;
}
}
inheritance in java
class Arithmetic {
}
class Adder extends Arithmetic {
public int add(int a, int b)
{
return a+b;
}
}
Inheritance in java
// Multiple inheritance in java
interface M
{
public void helloWorld();
}
interface N
{
public void helloWorld();
}
// implementing interfaces
public class MultipleInheritanceExample implements M, N
{
public void helloWorld()
{
System.out.println("helloWorld() method");
}
public static void main(String[] args)
{
MultipleInheritanceExample obj = new MultipleInheritanceExample();
obj.helloWorld();
}
}
inheritance in java
it is used to define relationship between two class,
which a child class occurs all the properties and
behaviours of a parent class.
Provides code reusability.
Ex: in my framework I have a TestBase
class which I store
all my reusable code and methods.
My test execution classes and
elements classes will extend the
TestBase in order to reuse the code.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us