45 lines
1.4 KiB
Java
45 lines
1.4 KiB
Java
|
package cn.bunny.atomic.reference;
|
||
|
|
||
|
import lombok.Getter;
|
||
|
|
||
|
public class DebitCard {
|
||
|
|
||
|
@Getter
|
||
|
private final String account;
|
||
|
@Getter
|
||
|
private final int amount;
|
||
|
|
||
|
public DebitCard(String account, int amount) {
|
||
|
this.account = account;
|
||
|
this.amount = amount;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Returns a string representation of the object.
|
||
|
*
|
||
|
* @return a string representation of the object.
|
||
|
* @apiNote In general, the
|
||
|
* {@code toString} method returns a string that
|
||
|
* "textually represents" this object. The result should
|
||
|
* be a concise but informative representation that is easy for a
|
||
|
* person to read.
|
||
|
* It is recommended that all subclasses override this method.
|
||
|
* The string output is not necessarily stable over time or across
|
||
|
* JVM invocations.
|
||
|
* @implSpec The {@code toString} method for class {@code Object}
|
||
|
* returns a string consisting of the name of the class of which the
|
||
|
* object is an instance, the at-sign character `{@code @}', and
|
||
|
* the unsigned hexadecimal representation of the hash code of the
|
||
|
* object. In other words, this method returns a string equal to the
|
||
|
* value of:
|
||
|
* <blockquote>
|
||
|
* <pre>
|
||
|
* getClass().getName() + '@' + Integer.toHexString(hashCode())
|
||
|
* </pre></blockquote>
|
||
|
*/
|
||
|
@Override
|
||
|
public String toString() {
|
||
|
return "DebitCard{" + "account='" + account + '\'' + ", amount=" + amount + '}';
|
||
|
}
|
||
|
}
|