자바 오버로딩 오버라이딩 차이 (1) 썸네일형 리스트형 [java(자바)] 오버로딩과 오버라이딩의 차이 _디버깅의 눈물 객체 지향 프로그래밍의 특징 중 다형성(Polymorphism)에는 대표적으로 오버로딩과 오버라이딩이 있습니다. 오버로딩 public class OverloadingExample { public static void main(String[] args) { int a = 10; int b = 20; double c = 3.14; int result1 = add(a, b); double result2 = add(a, b, c); System.out.println("result1 = " + result1); System.out.println("result2 = " + result2); } // int 타입 두 개를 더하는 메서드 public static int add(int x, int y) { return .. 이전 1 다음