- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdynamic_method.java
More file actions
Latest commit
29 lines (27 loc) · 596 Bytes
/
Copy pathdynamic_method.java
File metadata and controls
29 lines (27 loc) · 596 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
packagecom.company;
classPhone{
publicvoidshowTime(){
System.out.println("Time is 8 am");
}
publicvoidon()
{
System.out.println("Turning on the phone");
}
}
classSmartphoneextendsPhone{
publicvoidmusic()
{
System.out.println("Play music");
}
@Override
publicvoidon() {
System.out.println("Turning on smartphone");
}
}
publicclassdynamic_method {
publicstaticvoidmain(String[] args) {
Phones1=newSmartphone();
s1.on();
s1.showTime();
}
}