forked from mohammedabdulbari/Java-SE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverriding.java
More file actions
37 lines (23 loc) · 692 Bytes
/
Overriding.java
File metadata and controls
37 lines (23 loc) · 692 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
package overriding;
class TV
{
public void switchON(){ System.out.println("TV is Switched ON"); }
public void changeChannel() { System.out.println("TV Channel is Changed "); }
}
class SmartTV extends TV
{
@Override
public void switchON(){ System.out.println("Smart TV is Switched ON"); }
@Override
public void changeChannel() { System.out.println("SmartTV Channel is Changed "); }
public void browse(){ System.out.println("Smart Tv Browsing"); }
}
public class Overriding
{
public static void main(String[] args)
{
TV t=new SmartTV();
t.switchON();
t.changeChannel();
}
}