1class farmers
2{
3 String crops="Wheat";
4 void grows();
5 {
6 System.out.println(“Farmers grows Wheat”);
7 }
8}
9public class Animals extends farmers
10{
11 void eat();
12 {
13 System.out.println(“Animals eat Wheat”);
14 }
15
16public static void main (String args[])
17{
18 Animals obj=new Animals();
19 System.out.println(obj.crops);
20 obj.grows();
21 obj.eat();
22 }
23}
24
1Class farmers
2{
3 String crops="Wheat";
4 void grows();
5 {
6 System.out.println(“Farmers grows Wheat”);
7 }
8}
9Class Animals extends farmers
10{
11 void eat();
12 {
13 System.out.println(“Animals eat Wheat”);
14 }
15}
16Class Cat extends Animals
17{
18 void drink();
19 {
20 System.out.println(“Cat drinks milk”);
21 }
22
23public static void main (String args[])
24 {
25 Animals obj=new Animals();
26 System.out.println(obj.crops);
27 obj.grows();
28 obj.eat();
29 }
30}
31