package 객체지향;
public class Overloading {
public static void add(int a, int b) {
int result = a + b;
System.out.println(result);
}
public static void add(int a, int b, int c) {
int result = a + b + c;
System.out.println(result);
}
public static void main(String[] args) {
add(1,2);
add(1,2,3);
}
}
메소드 이름이 같더라도 매개변수를 달리 하여 쓰는 것을 오버로딩이라 한다.
'구 게시글 (~2020.01)' 카테고리의 다른 글
| [DB] any/all (0) | 2020.01.13 |
|---|---|
| [DB] 자체 참조 (0) | 2020.01.10 |
| [DB] 조인 (0) | 2020.01.09 |
| [DB] select 문 (0) | 2020.01.09 |
| [웹] CSS animation (0) | 2020.01.08 |