HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
✍🏻
Learnary (learn - diary)
/
🥉
Call By Value
🥉

Call By Value

progress
Done
Tags
Java
call by value vs vall by referencecall by valuecall by reference:

call by value vs vall by reference

call by value

  • 전달받은 값을 복사하여 처리.
  • 즉 전달받은 값은 변경하여도 원본은 변경되지 않는다(무조건x)
    • value일 때(변경 x)
    • object일 때(변경 x)
    • value in object(변경 가능)

call by reference:

  • 전달받은 값을 직접 참조.
  • 즉 전달받은 값을 변경할 경우 원본도 같이 변경.
 
주소 값을 복사해서 넘기기 때문에 이는 call by value입니다. 복사된 주소 값으로 참조가 가능하니 주소 값이 가리키는 객체의 내용 변경된다.
 
[Java] Java는 Call by reference가 없다
프로그래밍을 하다 보면 꼭 알고 넘어가야 하는 개념이 있습니다. 바로 Call By Value, Reference입니다. 어떤 언어를 공부하든 나오는 개념이기도 합니다. Call by value 란, 값을 호출하는 것을 의미합니다. 전달받은 값을 복사하여 처리합니다. 즉 전달받은 값을 변경하여도 원본은 변경되지 않습니다. Call by reference 란 참조에 의한 호출을 의미합니다. 전달받은 값을 직접 참조합니다.
[Java] Java는 Call by reference가 없다
https://deveric.tistory.com/92
[Java] Java는 Call by reference가 없다
🚀 Visualizing memory management in JVM(Java, Kotlin, Scala, Groovy, Clojure)
In this multi-part series, I aim to demystify the concepts behind memory management and take a deeper look at memory management in some of the modern programming languages. I hope the series would give you some insights into what is happening under the hood of these languages in terms of memory management.
🚀 Visualizing memory management in JVM(Java, Kotlin, Scala, Groovy, Clojure)
https://deepu.tech/memory-management-in-jvm/
🚀 Visualizing memory management in JVM(Java, Kotlin, Scala, Groovy, Clojure)
public class A { public int value; public A(int i) { this.value = i; } }` `public class Test2 { public static void main(String[] args) { A a1 = new A(1); A a2 = new A(2); run(a1, a2); System.out.println(a1.value); // 111 System.out.println(a2.value); // 2 } static void run(A arg1, A arg2){ arg1.value = 111; arg2 = arg1; } }