-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathISA_Demo.java
More file actions
43 lines (33 loc) · 879 Bytes
/
ISA_Demo.java
File metadata and controls
43 lines (33 loc) · 879 Bytes
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
class Account {
String name;
int accNo;
void roi() {
System.out.println("ROI is 6%");
}
void withdrawLimit() {
System.out.println("Withdraw limit is 50000");
}
}
// Inheritance - inheriting properties of parent class
class SavingAcc extends Account {
void depositLimit() {
System.out.println("Deposit limit is 1 Lac");
}
}
class CurrentAcc extends Account {
void minBal() {
System.out.println("Minimum balance must be 10000");
}
}
public class ISA_Demo {
public static void main(String[] args) {
SavingAcc sa = new SavingAcc();
sa.depositLimit(); // belongs to SavingAccount Class
sa.roi(); // belongs to Account class
sa.withdrawLimit(); // belongs to Account class
CurrentAcc ca = new CurrentAcc();
ca.roi();
ca.withdrawLimit();
ca.minBal(); // belongs to CurrentAccount Class
}
}