Define a class Person with fields for name and age.
Note: Add the following code to your main method:
public static void main(String[] args) throws Exception {
Class person = Class.forName("Person");
Field[] fields = person.getDeclaredFields();
System.out.println(fields.length);
}
The output on the console should be 2. If you defined the class correctly, the test should pass.
Bonus*
Try to create a few objects of type Person:
Name
|
Age
|
Pesho
|
20
|
Gosho
|
18
|
Stamat
|
43
|
Use both the inline initialization and the default constructor.