// An application with a class that provides information
about a person.
public class People
{
public static void main (String []
args)
{
Person girl
= new Person ("Alice", 7);
girl.displayAge
();
} // main method
} // class People
// Class that stores information about a person's name
and age.
class Person
{
private String name;
private int age;
// Constructor class that initializes
person.
public Person (String n, int a)
{
name = n;
age = a;
} // constructor
// Method that displays the name and
age of a person.
public void displayAge ()
{
System.out.println
(name + "'s age is " + age);
} // method displayAge
} // class Person