Java Reference
In-Depth Information
private static final long serialVersionUID = 7001L;
}
Directory "TryPolyLineObjects"
The LinkedList class and its inner class likewise:
import java.io.Serializable;
public class LinkedList implements Serializable {
// Class definition as before...
private static final long serialVersionUID = 7001L;
private class ListItem implements Serializable {
// Inner class definition as before...
private static final long serialVersionUID = 7001L;
}
}
Directory "TryPolyLineObjects"
The class to write PolyLine objects to a stream looks like this:
import java.io.*;
import java.nio.file.*;
public class TryPolyLineObjects {
public static void main(String[] args) {
// Create an array of coordinate pairs
double[][] coords = { {1., 1.}, {1., 2.}, { 2., 3.},
{-3., 5.}, {-5., 1.}, {0., 0.} };
Path file = Paths.get(System.getProperty("user.home")).
resolve("Beginning Java
Stuff").resolve("Polygons.bin");
try {
Files.createDirectories(file.getParent()); // Make sure we have
directory
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
Search WWH ::




Custom Search