-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSolution.java
More file actions
53 lines (40 loc) · 1.84 KB
/
Solution.java
File metadata and controls
53 lines (40 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//When Pilate therefore heard these words, he brought Jesus out, and sat down on the judgment seat at a place called "The Pavement," but in Hebrew, "Gabbatha." (John 19:13)
package com.javarush.task.task20.task2021;
import java.io.*;
/*
Сериализация под запретом
*/
public class Solution implements Serializable {
public static class SubSolution extends Solution {
public void writeObject(ObjectOutputStream out) throws Exception {
throw new NotSerializableException();
}
public void readObject(ObjectInputStream in) throws Exception {
throw new NotSerializableException();
}
}
public static void main(String[] args) {
}
}
/*
Сериализация под запретом
Запрети сериализацию класса SubSolution используя NotSerializableException.
Сигнатуры классов менять нельзя.
Требования:
1. Класс Solution должен поддерживать интерфейс Serializable.
2. Класс SubSolution должен быть создан внутри класса Solution.
3. Класс SubSolution должен быть потомком класса Solution.
4. При попытке сериализовать объект типа SubSolution должно возникать исключение NotSerializableException.
5. При попытке десериализовать объект типа SubSolution должно возникать исключение NotSerializableException.
package com.javarush.task.task20.task2021;
import java.io.*;
*
Сериализация под запретом
*
public class Solution implements Serializable {
public static class SubSolution extends Solution {
}
public static void main(String[] args) {
}
}
*/