Total WebSite Views Count

Is Java Pass by Reference or Pass by Value

Is Java Pass by Reference or Pass by Value?

  • The Java Spec says that everything in Java is pass-by-value
  • There is no such thing as “pass-by-reference” in Java. 
These terms are associated with method calling and passing variables as method parameters. Well, primitive types are always pass by value without any confusion. But, the concept should be understood in context of method parameter of complex types.
  • In java, when we pass a reference of complex types as any method parameters, always the memory address is copied to new reference variable bit by bit. 

  • In above example, address bits of first instance are copied to another reference variable, thus resulting both references to point a single memory location where actual object is stored. 

  • Remember, making another reference to null will not make first reference also null. But, changing state from either reference variable have impact seen in other reference also.

AWS Services

AWS Services

Technology Selection & Evaluation Criteria

Technology Selection & Evaluation Criteria

Scale Cube - Scale In X Y Z Cube

Scale Cube - Scale In X Y Z Cube

Feature Post

AWS Services

About Me

About Me

Spring Cloud

Spring Cloud
Spring Cloud

Spring Cloud +mCloud Native + Big Data Archittect

Spring Cloud +mCloud Native + Big Data Archittect

ACID Transaction

ACID Transaction

Data Pipe Line Stack

Data Pipe Line Stack

Popular Posts