프로그래밍 기초1 [JAVA] Call by Value 메도스에 값(primitive type)을 전달하는 것과 객체(reference type)를 전달하는 것에는 큰 차이가 있다. 메소드로 객체를 전달할 경우 메소드에서 객체의 객체변수(속성) 값을 변경할 수 있게 된다. Counter.java class Updater { public void update(int count) { count++; } } public class Counter { int count = 0; // 객체변수 public static void main(String[] args) { Counter myCounter = new Counter(); System.out.println("before update:"+myCounter.count); Updater myUpdater = new Up.. 2020. 6. 11. 이전 1 다음