~/ learn/ java-from-zero/ cards/ Object: the root of every class
1 of 4

Type the default toString output pattern as a comment

Type the default toString output pattern as a comment

Answer

// Default: ClassName@hexHashCode System.out.println(new Dog("Rex", 3)); // Dog@6d06d69c

Without overriding toString(), println delegates to Object.toString() which produces type@hashcode. Override it to get human-readable output.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/e17f6566-5fd0-4dc0-a6b0-8b23459362fb/flashcard utf-8 LF