"Hej, Amigo! Du er blevet lidt blød! Her er dine øvelser. Hvis du løber ind i vanskeligheder, så tjek med dine kollegaer. De vil helt sikkert hjælpe."
"Du har allerede gjort alt? Nå, her er nogle øvelser, der er endnu sværere:"
6
Opgave
Java Core, niveau, lektie
Minimum changes
With minimum code changes, make it possible to serialize the C class.
12
Opgave
Java Core, niveau, lektie
Deserialization
Serialized A or B objects are written to the stream that is passed in.
Deserialize the object in the getOriginalObject method. If an exception occurs, display a message and return null.
Implement the Serializable interface where necessary.
20
Opgave
Java Core, niveau, lektie
Find the bugs
For some reason, errors are occurring when serializing/deserializing B objects.
Find the problem and fix it.
The A class should not implement the Serializable and Externalizable interfaces.
There is no error in the B class's signature :).
There are no errors in the main method.
6
Opgave
Java Core, niveau, lektie
Correct the mistake. Serialization
After deserializing a Solution object, map m was discovered to have no data :(
Fix 1 bug.
6
Opgave
Java Core, niveau, lektie
Serializing people
Serialize the Person class in the standard way. Add the transient modifier to some fields, if necessary.
6
Opgave
Java Core, niveau, lektie
Serialization is prohibited
Block serialization of the SubSolution class using the NotSerializableException.
Don't change the method signatures.
20
Opgave
Java Core, niveau, lektie
Overriding serialization in a thread
Serializing/deserializing the Solution class doesn't work.
Fix the bugs without changing method or class signatures.
The main method is not tested.
Write the verification code yourself in the main method:
1) create an instance of the Solution class
2) write data to it (writeObject)
3) serialize the
12
Opgave
Java Core, niveau, lektie
Making the right conclusion
Arrange calls to the superclass's methods and access modifiers to achieve the following screen output:
C class, method2
A class, method2
A class, method1
B class, method1
1. Only one of the superclass's methods can be called from each method.
2. Only one of the class's methods can be called from e
12
Opgave
Java Core, niveau, lektie
Introducing graphs
Read the additional materials on serialization of graphs.
The Solution class has a directed planar graph containing cycles and loops.
For example, http://edu.nstu.ru/courses/saod/images/graph1.gif
Serialize Solution.
The direction of all of the edges must remain the same.
20
Opgave
Java Core, niveau, lektie
Number algorithms
Suppose the number S consists of M digits. For example, if S = 370, then M (the number of digits) = 3
Implement the getNumbers method. Among natural numbers less than N (long), it should
find all the numbers satisfying the following criterion:
The number S is equal to the sum of its digits raised in the Mth
12
Opgave
Java Core, niveau, lektie
Rectangle algorithms
1. Here we have a two-dimensional N*N array that contains several rectangles.
2. The various rectangles do not touch or overlap.
3. The interior of each rectangle is filled with 1s.
4. The array values have the following meaning:
4.1) a[i, j] = 1 if element (i, j) belongs to a rectangle
4.2) a[i, j]
20
Opgave
Java Core, niveau, lektie
Word search
1. We have a two-dimensional array that contains lowercase letters.
2. The detectAllWords method must find all the words in the wordSearch array.
3. The element(startX, startY) must correspond to the first letter of the word, while the element(endX, endY) corresponds to the last letter.
text is the