正在加载图片...
最病 A Java Object Serialization --Example 7 public class Client public static void main( String args[) try(//Create a socket Socket soc new Socket(Inet Address getLocalHost(), 8020) ○ utput Strean。= soc. get Output Stream(); Object Output s new Object Output Stream(o); s write Object("Todays date"); swrite Object(new Date())i sclose();] catch(Exception e)t System. out. printIn(e get Message()) System. out. printIn (" Error during serialization") System. exit(1);] Institute of Computer Software 2021/1/28 Nanjing UniversityJava Object Serialization -- Example public class Client { public static void main(String args[]) { try { // Create a socket Socket soc = new Socket(InetAddress.getLocalHost(), 8020); OutputStream o = soc.getOutputStream(); ObjectOutput s = new ObjectOutputStream(o); s.writeObject("Today's date"); s.writeObject(new Date()); s.flush(); s.close(); } catch (Exception e) { System.out.println(e.getMessage()); System.out.println("Error during serialization"); System.exit(1); } } } 2021/1/28 Institute of Computer Software Nanjing University 7
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有