-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment46_.java
More file actions
77 lines (60 loc) · 1.59 KB
/
Assignment46_.java
File metadata and controls
77 lines (60 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package abhilash_Asignments;
//WAP in which super most class having 2CM, abstract class having 2AM&2CM, subclass having 2CM
class Grandparents
{
void add() {
System.out.println("Addition");
}
void sub() {
System.out.println("Subtraction");
}
}
abstract class Father extends Grandparents
{
abstract void multiply();
abstract void divid();
void Animals()
{
System.out.println("Animals");
}
void Tiger()
{
System.out.println("Tiger");
}
}
//Subclass with 2 concrete methods (CM) and implementation of abstract method
public class Assignment46_ extends Father
{
@Override
void multiply()
{
System.out.println("This is Multicpication");
}
@Override
void divid()
{
System.out.println("This is division");
}
//concrate methods
void College()
{
System.out.println("Jayamukhi College");
}
void Department()
{
System.out.println("Mechanical Department");
}
public static void main(String[] args)
{
Assignment46_ A1 = new Assignment46_();
// Accessing methods from different classes by creating an object for subclass
A1.add(); // Inherited from Grandparents
A1.sub(); // Inherited from Grandparents
A1.multiply(); // Implemented in Assignment46_
A1.divid(); // Implemented in Assignment46_
A1.College(); // Defined in Assignment46_
A1.Department(); // Defined in Assignment46_
A1.Tiger(); // Inherited from Father
A1.Animals(); // Inherited from Father
}
}