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.