-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
34 lines (29 loc) · 743 Bytes
/
Main.java
File metadata and controls
34 lines (29 loc) · 743 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
class Test {
String name, address;
public Test(String name, String address) {
this.name = name;
this.address = address;
}
public String toString() {
return "name= " + name + ", address= " + address;
}
}
class Ad extends Test {
int age;
public Ad(String name, String address, int age) {
super(name, address);
this.age = age;
}
@Override
public String toString() {
return super.toString() + ", age= " + age;
}
}
public class Main {
public static void main(String[] args) {
Test t1 = new Test("Prince", "Bhadohi");
System.out.println(t1);
Ad a1 = new Ad("Aman", "Varanasi", 50);
System.out.println(a1);
}
}