latest {main: fixes
This commit is contained in:
parent
df864d009d
commit
9659aa6adf
@ -3,6 +3,8 @@
|
|||||||
// We make no guarantees that this code is fit for any purpose.
|
// We make no guarantees that this code is fit for any purpose.
|
||||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||||
// Recover a serialized file
|
// Recover a serialized file
|
||||||
|
// {main: serialization.xfiles.ThawAlien}
|
||||||
|
// {RunFirst: FreezeAlien}
|
||||||
package serialization.xfiles;
|
package serialization.xfiles;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@ -10,7 +12,7 @@ public class ThawAlien {
|
|||||||
public static void
|
public static void
|
||||||
main(String[] args) throws Exception {
|
main(String[] args) throws Exception {
|
||||||
ObjectInputStream in = new ObjectInputStream(
|
ObjectInputStream in = new ObjectInputStream(
|
||||||
new FileInputStream(new File("..", "X.file")));
|
new FileInputStream(new File("X.file")));
|
||||||
Object mystery = in.readObject();
|
Object mystery = in.readObject();
|
||||||
System.out.println(mystery.getClass());
|
System.out.println(mystery.getClass());
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// (c)2016 MindView LLC: see Copyright.txt
|
// (c)2016 MindView LLC: see Copyright.txt
|
||||||
// We make no guarantees that this code is fit for any purpose.
|
// We make no guarantees that this code is fit for any purpose.
|
||||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||||
|
// {main: staticchecking.dr.DogsAndRobots}
|
||||||
package staticchecking.dr;
|
package staticchecking.dr;
|
||||||
|
|
||||||
interface Speaks { void talk(); }
|
interface Speaks { void talk(); }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// (c)2016 MindView LLC: see Copyright.txt
|
// (c)2016 MindView LLC: see Copyright.txt
|
||||||
// We make no guarantees that this code is fit for any purpose.
|
// We make no guarantees that this code is fit for any purpose.
|
||||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||||
|
// {main: staticchecking.drc.DogAndRobotCollections}
|
||||||
package staticchecking.drc;
|
package staticchecking.drc;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// (c)2016 MindView LLC: see Copyright.txt
|
// (c)2016 MindView LLC: see Copyright.txt
|
||||||
// We make no guarantees that this code is fit for any purpose.
|
// We make no guarantees that this code is fit for any purpose.
|
||||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||||
|
// {main: staticchecking.latent.Latent}
|
||||||
package staticchecking.latent;
|
package staticchecking.latent;
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// We make no guarantees that this code is fit for any purpose.
|
// We make no guarantees that this code is fit for any purpose.
|
||||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||||
// Speaking pets in Java
|
// Speaking pets in Java
|
||||||
|
// {main: staticchecking.petspeak.PetSpeak}
|
||||||
package staticchecking.petspeak;
|
package staticchecking.petspeak;
|
||||||
|
|
||||||
interface Pet {
|
interface Pet {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// We make no guarantees that this code is fit for any purpose.
|
// We make no guarantees that this code is fit for any purpose.
|
||||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||||
// The difference between instanceof and class
|
// The difference between instanceof and class
|
||||||
|
// {main: typeinfo.FamilyVsExactType}
|
||||||
package typeinfo;
|
package typeinfo;
|
||||||
|
|
||||||
class Base {}
|
class Base {}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// We make no guarantees that this code is fit for any purpose.
|
// We make no guarantees that this code is fit for any purpose.
|
||||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||||
// Using class literals
|
// Using class literals
|
||||||
|
// {main: typeinfo.pets.LiteralPetCreator}
|
||||||
package typeinfo.pets;
|
package typeinfo.pets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// We make no guarantees that this code is fit for any purpose.
|
// We make no guarantees that this code is fit for any purpose.
|
||||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||||
// Testing class Class
|
// Testing class Class
|
||||||
|
// {main: typeinfo.toys.GenericToyTest}
|
||||||
package typeinfo.toys;
|
package typeinfo.toys;
|
||||||
|
|
||||||
public class GenericToyTest {
|
public class GenericToyTest {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// We make no guarantees that this code is fit for any purpose.
|
// We make no guarantees that this code is fit for any purpose.
|
||||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||||
// Testing class Class
|
// Testing class Class
|
||||||
|
// {main: typeinfo.toys.ToyTest}
|
||||||
package typeinfo.toys;
|
package typeinfo.toys;
|
||||||
|
|
||||||
interface HasBatteries {}
|
interface HasBatteries {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user