Chapter

Common Methods

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. How are Java class instances created and used?

    "Once we have defined our class and its constructors, we can create and use instances of it. Just as with regular variables, we need to declare instances of a class by providing the type and a variabl

  2. How can the toString() method represent a Java object?

    "The toString() method returns a String representation of the object. However, the default behavior that all classes inherit from the Object class is that it returns a string containing the fully qual

  3. How do equals() and hashCode() define object equality in Java?

    "Two other methods, the equals() and the hashCode() method are used extensively by other classes such as the Collections library. The equals() method:\n\npublic boolean equals(Object obj)\n\ntakes ano

Common Methods | ComputerScienceOne | Bifalgorithm | Bifalgorithm