forked from IND-Debugs/Java-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInheritate.java
More file actions
43 lines (39 loc) · 752 Bytes
/
Copy pathInheritate.java
File metadata and controls
43 lines (39 loc) · 752 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
43
package Allprogram;
class A{
int c;
public int add(int x,int y)
{
c = x+y;
return c;
}
public int sub(int x,int y)
{
c = x-y;
return c;
}
}
public class Inheritate extends A {
public int multiply(int x,int y)
{
c = x*y;
return c;
}
public int division(int x,int y)
{
c = x/y;
return c;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int c;
Inheritate obj = new Inheritate();
c = obj.add(2,4);
System.out.println("adition is " +c);
c = obj.sub(6,2);
System.out.println("subtraction is " +c);
c = obj.multiply(3,4);
System.out.println("multiply is " +c);
c = obj.division(6,3);
System.out.println("division is " +c);
}
}