[Java] TDD Barely #4 (July 16th, 2020)

less than 1 minute read

New knowledge

toString method

public String toString()
// returns a string representation of the object

Expression

Creates and calls a “new” Expression method with the specified value of the specified object.

interface

Only constants and methods can be defined.

interface AAA {
     int A1 = 1;
     int A2 = 2;

     void BBB();
}

Use implements to implement the interface in the class.

class abc implements AAA{
}

instanceof operator

Dynamically determine the type of an object. An object ・Is it an instance of a certain class? ・Is it an instance of a child class of a certain class? Is it an instance that implements a specific interface?