latest {main: fixes

This commit is contained in:
Bruce Eckel 2016-07-07 16:23:19 -06:00
parent df864d009d
commit 9659aa6adf
9 changed files with 11 additions and 1 deletions

View File

@ -3,6 +3,8 @@
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Recover a serialized file
// {main: serialization.xfiles.ThawAlien}
// {RunFirst: FreezeAlien}
package serialization.xfiles;
import java.io.*;
@ -10,7 +12,7 @@ public class ThawAlien {
public static void
main(String[] args) throws Exception {
ObjectInputStream in = new ObjectInputStream(
new FileInputStream(new File("..", "X.file")));
new FileInputStream(new File("X.file")));
Object mystery = in.readObject();
System.out.println(mystery.getClass());
}

View File

@ -2,6 +2,7 @@
// (c)2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// {main: staticchecking.dr.DogsAndRobots}
package staticchecking.dr;
interface Speaks { void talk(); }

View File

@ -2,6 +2,7 @@
// (c)2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// {main: staticchecking.drc.DogAndRobotCollections}
package staticchecking.drc;
import java.util.*;

View File

@ -2,6 +2,7 @@
// (c)2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// {main: staticchecking.latent.Latent}
package staticchecking.latent;
import java.lang.reflect.*;

View File

@ -3,6 +3,7 @@
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Speaking pets in Java
// {main: staticchecking.petspeak.PetSpeak}
package staticchecking.petspeak;
interface Pet {

View File

@ -3,6 +3,7 @@
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// The difference between instanceof and class
// {main: typeinfo.FamilyVsExactType}
package typeinfo;
class Base {}

View File

@ -3,6 +3,7 @@
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Using class literals
// {main: typeinfo.pets.LiteralPetCreator}
package typeinfo.pets;
import java.util.*;

View File

@ -3,6 +3,7 @@
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Testing class Class
// {main: typeinfo.toys.GenericToyTest}
package typeinfo.toys;
public class GenericToyTest {

View File

@ -3,6 +3,7 @@
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Testing class Class
// {main: typeinfo.toys.ToyTest}
package typeinfo.toys;
interface HasBatteries {}