-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathachootty.java
More file actions
43 lines (22 loc) · 764 Bytes
/
achootty.java
File metadata and controls
43 lines (22 loc) · 764 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
class polymorphism {
void add (int a, int b) {
System.out.println("sum of the two numbers is: " +(a + b) );
}
void add (int a, int b , int c) {
System.out.println("sum of the three numbers is: "+(a + b + c));
}
/*void area (double base, double hieght) {
System.out.println("Area of the triangle is: "+(0.5*base*hieght));
}*/
}
class achootty {
public static void main(String[] arguments) {
polymorphism object = new polymorphism ();
/*To print the area of a circle having radious 10*/
object.add(10,10);
/*To print the area of a square having lenghth 10 and breadth 20 */
object.add(10, 20 ,30);
/*To print the area of a triangle having length 10 and hieght 20 */
//object.area(10.0, 20.0);
}
}