Finished example.
This commit is contained in:
@@ -1,5 +1,21 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public class Oliphaunt {
|
||||
|
||||
|
||||
private static int counter = 1;
|
||||
|
||||
private final int id;
|
||||
|
||||
public Oliphaunt() {
|
||||
id = counter++;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Oliphaunt id=%d", id);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user