Skip to content

Commit 7e95b45

Browse files
author
Yalun Qin
committed
Add more to SerializeTest.java
1 parent d5211ec commit 7e95b45

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

Cat.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ public Cat(int age, int size, int tailSize) {
99
}
1010

1111
public String toString() {
12-
return "Age = " + age
13-
+ ", Size = " + size
12+
return super.toString()
1413
+ ", tailSize = " + tailSize;
1514
}
1615
}

SerializeTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ public class SerializeTest {
99
public static void main (String[] args) {
1010
Animal animal1 = new Cat(10, 30, 20);
1111

12+
//If person is not null, there will be NotSerializableException when serializing animal1.
13+
//animal1.setOwner(new Person("Yalun", 20));
14+
1215
byte[] animalBytes = null;
1316

17+
System.out.println(animal1.getClass());
18+
System.out.println(animal1.toString());
19+
1420
try {
1521
ByteArrayOutputStream bos = new ByteArrayOutputStream();
1622
ObjectOutputStream out = new ObjectOutputStream(bos);

0 commit comments

Comments
 (0)