About Java

1.

Getting straight to the point, Java's parameter passing method is 'Pass by Value with Shallow Copy'.

For example,

Let's 

And I guess this make sense for Java because Java does not support copy constructor. If it were C++, code like above should have been supposed as an error, especially because of not defining copy constructor. Pass-by-Value is not supposed to manipulate any data of the original instance. 

However, there is no copy constructor on Java and everybody's using the parameter passing as if it were 'Pass-by-Value for primitive types, but Pass-by-Reference for reference types.'

2.
Wrapper class is a class that is used to wrap primitive type(int, float, long... etc) as a 'class'. It is usually a name of its primitive type starting with a larger case: int -> Integer, float -> Float

It is used to replace variable that contains primitive type with a instance of a class. It is also used to describe a 'NULL' state because primitive type cannot.

댓글

이 블로그의 인기 게시물

Interface of Java

Data Analytics Overview(OLTP vs OLAP)

Leetcode