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?

【オブジェクトとかプロパティって何?】

Posted at

オブジェクト = 「情報をまとめる箱」「実際の本」
プロパティ = 「オブジェクトの中の情報」「実際の情報」

クラス = 「本の設計図」(どんな情報を持つか決める。物語なのか推理小説なのか~とかその辺から。「本の型」 なので、実際の本はまだ。)
フィールド = 「クラスの中にあるデータ」(設計図から作る)
例えば本を買いたいとき、本には出版社、値段、作者名、題名等いろんな情報がある。これらを一つにまとめておくのがオブジェクト。
本←オブジェクト

題名:Java入門 ←プロパティ
出版社:つの川 ←プロパティ
値段:2000円 ←プロパティ
作者名:匿名希望 ←プロパティ

だから本っていうオブジェクトをコピーすれば、中身もついてくるから、本屋さんはいちいち「本の情報は何がある?題名と値段と、…。あ!この本出版社の情報書き忘れてた!」みたいなのがなくなる。

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?