-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathAbstractDemo.java
More file actions
58 lines (50 loc) · 1.16 KB
/
AbstractDemo.java
File metadata and controls
58 lines (50 loc) · 1.16 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
/*
* Abstract Class Acting as a parent class and Object Creation not
* allowed
* It may have abstract methods and child need to override the
* abstract methods , if child not override the abstract methds
* so child is treated as abstract
*/
abstract class Account
{
//Generic (Common) Features
int balance;
String name;
void deposit(){
System.out.println("Deposit Generic Logic...");
}
abstract void roi();
}
class SavingAccount extends Account{
void doorToDoorService(){
System.out.println("Saving Account has door to door service");
}
@Override
void roi(){
System.out.println("Saving A/C ROI CALL");
}
}
class CurrentAccount extends Account{
void odLimit(){
System.out.println("Current Account Has OD LImit..");
}
@Override
void roi(){
System.out.println("Current A/C ROI CALL");
}
}
class Customer{
//Account ca = new Account();
}
public class AbstractDemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
//Account account = new Account();
CurrentAccount ca = new CurrentAccount();
ca.deposit();
ca.odLimit();
SavingAccount sa = new SavingAccount();
sa.deposit();
sa.doorToDoorService();
}
}