try { ObjectInputStream ois = new ObjectInputStream(new FileInputStream("data.obj")); boolean b = ois.readBoolean(); System.out.println("Boolean Value: " + b); ois.close(); } catch (IOException e) { e.printStackTrace(); }
try { ObjectInputStream ois = new ObjectInputStream(socket.getInputStream()); boolean b = ois.readBoolean(); System.out.println("Boolean Value: " + b); ois.close(); } catch (IOException e) { e.printStackTrace(); }Package library: java.io