-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainProgram1.java
More file actions
61 lines (49 loc) · 1.31 KB
/
MainProgram1.java
File metadata and controls
61 lines (49 loc) · 1.31 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
54
55
56
57
58
59
60
61
package com.CodeWithSarnav;
class A{
int a,b,c;
A(){
System.out.println("------------------Defined for class A------------------");
}
void set(int a, int b, int c){
this.a=a;
this.b=b;
this.c=c;
}
void show(){
System.out.println("The first input is "+a);
System.out.println("The second input is "+b);
System.out.println("The third input is "+c);
}
}
class B extends A{
int d,e;
B(){
System.out.println("------------------Defined for class B------------------");
}
void set(int a, int b, int c, int d, int e){
this.a=a;
this.b=b;
this.c=c;
this.d=d;
this.e=e;
}
void show(){
System.out.println("The first input is "+a);
System.out.println("The second input is "+b);
System.out.println("The second input is "+c);
System.out.println("The first input is "+d);
System.out.println("The second input is "+e);
}
}
public class Main {
public static void main(String[] args) {
// write your code here
A a = new A();
a.set(3,5,8);
a.show();
System.out.println();
B b = new B();
b.set(7,8,8,44,44);
b.show();
}
}