0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Java】問題No.2

0
Posted at

問題2

  • プリミティブ型と参照型の違いは何でしょうか?

解答2

プリミティブ型

  • メモリ空間に実際の値が格納されています。
    プリミティブ型は型自体にサイズを持っています。
    そのため、int型で1桁を表すのに1桁分のサイズを持つというわけではありません。
    たとえば、int型の場合、実際の表現は下記の通りとなります。
     整数値10の場合
     00000000000000000000000000001010
    簡単に言うと、プリミティブ型は型によって、サイズ(=bit数)が定まっている。
    ということになります。

参照型

  • メモリ空間に実際の値が保存されているのではなく、
    値が格納されているアドレス値が保存されている。
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?