-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractionEX2.java
More file actions
60 lines (52 loc) · 1.04 KB
/
AbstractionEX2.java
File metadata and controls
60 lines (52 loc) · 1.04 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
package Encapsulation;
abstract class Bank
{
abstract void getintrestrate();
void display()
{
System.out.println("Welcome to the Bank");
}
}
class SBI extends Bank
{
@Override
void getintrestrate()
{
System.out.println("SBI Intrest rate is : 7%");
}
}
class HDFC extends Bank
{
@Override
void getintrestrate()
{
System.out.println("HDFC intrest rate is : 8%");
}
}
class ICICI extends Bank
{
@Override
void getintrestrate()
{
System.out.println("ICICI intrest rate is : 7.5%");
}
}
public class AbstractionEX2
{
public static void main(String[]args)
{
System.out.println("======================");
Bank B = new SBI();
B.display();
B.getintrestrate();
System.out.println("======================");
Bank B1 = new HDFC();
B1.display();
B1.getintrestrate();
System.out.println("======================");
Bank B2 = new ICICI();
B2.display();
B2.getintrestrate();
System.out.println("======================");
}
}