1. 学习
  2. /
  3. 课程
  4. /
  5. Introduction to Object-Oriented Programming in Java

Connected

练习

Creating private properties

Class properties are often made private to restrict external access. For instance, in a Passport class, certain fields should be set only under specific conditions. You will make a car’s registration number private in the Car class to hide it.

说明

100 XP
  • Create a new private property called vehicleNumber that is an int type.