반응형 메소드오버라이딩1 JAVA Call by value, 클래스 상속(Inheritance) - JAVA Call by value class Updater { void update(int count) { count++; } } class Counter { int count = 0; // 객체변수 } public class Sample { public static void main(String[] args) { Counter myCounter = new Counter(); System.out.println("before update:"+myCounter.count); Updater myUpdater = new Updater(); myUpdater.update(myCounter.count); System.out.println("after update:"+myCounter.count); } } 위와같.. 2023. 4. 4. 이전 1 다음 반응형