Loading

Exercise Number: 1

 Instance Variable

Scenario: You are creating a class to represent a person. Each person has a unique ID.

Task:

  1. Create a class Person with an instance variable personId to store the ID of the person.
  2. Create a constructor to initialize the personId.
  3. Create a method to display the person's ID.
  4. Create two objects of the Person class with different IDs and display their IDs.