Skip to content

Commit 54d41b8

Browse files
authored
Create Overloading.java
1 parent adb2d10 commit 54d41b8

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

OOPs/Overloading.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
class Bike extends Vehicle{
3+
4+
/**
5+
* Example of method Overloading
6+
* Method name must be same
7+
*/
8+
9+
void start(int x, int y){
10+
System.out.println("method 1");
11+
}
12+
13+
void start(int x){
14+
System.out.println("method 2");
15+
}
16+
17+
public static void main(String args[]){
18+
Bike b = new Bike();
19+
b.start(1);
20+
b.start(1,2);
21+
}
22+
}

0 commit comments

Comments
 (0)