Class Person


  • public class Person
    extends java.lang.Object
    Simple person class with a name and an address.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String address
      The address.
      protected java.lang.String name
      The name.
    • Constructor Summary

      Constructors 
      Constructor Description
      Person​(java.lang.String name, java.lang.String address)
      Create a new person.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Test if two persons are equal.
      java.lang.String getAddress()
      Get the address.
      java.lang.String getName()
      Get the name.
      int hashCode()
      Calculate the hashcode.
      void setAddress​(java.lang.String address)
      Set the address.
      void setName​(java.lang.String name)
      Set the name.
      java.lang.String toString()
      Get the string representation.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        protected java.lang.String name
        The name.
      • address

        protected java.lang.String address
        The address.
    • Constructor Detail

      • Person

        public Person​(java.lang.String name,
                      java.lang.String address)
        Create a new person.
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the name.
        Returns:
        The name.
      • setName

        public void setName​(java.lang.String name)
        Set the name.
        Parameters:
        name - The name.
      • getAddress

        public java.lang.String getAddress()
        Get the address.
        Returns:
        The address.
      • setAddress

        public void setAddress​(java.lang.String address)
        Set the address.
        Parameters:
        address - The address.
      • equals

        public boolean equals​(java.lang.Object o)
        Test if two persons are equal.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o -
        Returns:
        True if the object is an equal person.
      • hashCode

        public int hashCode()
        Calculate the hashcode.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The hashcode.
      • toString

        public java.lang.String toString()
        Get the string representation.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation.