Sunday 15 November 2020

Inheritance concept

 package practice.test;


class One {

public void print_greek() {

System.out.println("Geeks");

}

}


class Two extends One{

public void print_for() {

System.out.println("For");

}

}


class Main

{

public static void main(String[] args) {

Two t=new Two();

t.print_greek();

t.print_for();

t.print_greek();

}

}

No comments:

Post a Comment