2016-08-24 16:28:10 -06:00
|
|
|
// generics/Shape.java
|
2021-01-31 15:42:31 -07:00
|
|
|
// (c)2021 MindView LLC: see Copyright.txt
|
2016-08-24 16:28:10 -06:00
|
|
|
// We make no guarantees that this code is fit for any purpose.
|
2016-09-23 13:23:35 -06:00
|
|
|
// Visit http://OnJava8.com for more book information.
|
2016-08-24 16:28:10 -06:00
|
|
|
|
|
|
|
public class Shape {
|
|
|
|
private static long counter = 0;
|
|
|
|
private final long id = counter++;
|
2021-01-31 15:42:31 -07:00
|
|
|
@Override public String toString() {
|
2016-08-24 16:28:10 -06:00
|
|
|
return getClass().getSimpleName() + " " + id;
|
|
|
|
}
|
|
|
|
public void rotate() {
|
|
|
|
System.out.println(this + " rotate");
|
|
|
|
}
|
|
|
|
public void resize(int newSize) {
|
|
|
|
System.out.println(this + " resize " + newSize);
|
|
|
|
}
|
|
|
|
}
|