Quantcast
Channel: OKWAVE 閲覧数の多い質問(Java/253)【本日】
Viewing all articles
Browse latest Browse all 68675

ゲッターを使わないで変数にアクセスする(java)

$
0
0
経験10年以上のベテランの人が privateフィールドに対してゲッターを使わないで、if (!checkExist(this.productCode))としていました。 自分は未経験ですが、privateフィールドのアクセスはゲッターを使うべきだと思いましたし、“!”を使うのは分かりにくいのでif (checkExist(getProductCode()) == false)としました。 どちらの方が良いコードですか?

Viewing all articles
Browse latest Browse all 68675

Latest Images

Trending Articles

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>