-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterfaces.java
More file actions
42 lines (34 loc) · 866 Bytes
/
Interfaces.java
File metadata and controls
42 lines (34 loc) · 866 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
package oops;
public class Interfaces{
public static void main(String[] args) {
Anonymous p1 = new Anonymous("Rahul Dey",728,"HP",485000);
p1.details();
p1.profile();
}
}
class Anonymous implements Laptop,Hacker{
public String brand ;
public int price ;
public String name ;
public int score ;
Anonymous(String name,int score,String brand,int price){
this.name = name;
this.price = price;
this.brand = brand;
this.score = score;
}
@Override
public void details() {
System.out.println("Brand : "+this.brand+"\nPrice : "+this.price);
}
@Override
public void profile() {
System.out.println("Name : "+this.name+"\nScore : "+this.score);
}
}
interface Laptop{
public void details();
}
interface Hacker{
public void profile();
}