zoukankan      html  css  js  c++  java
  • Serializable

      1. import java.io.*;
      2.   
      3. public class  Box implements Serializable  
      4. {  
      5.     private int width;  
      6.     private int height;  
      7.   
      8.     public void setWidth(int width){  
      9.         this.width  = width;  
      10.     }  
      11.     public void setHeight(int height){  
      12.         this.height = height;  
      13.     }  
      14.   
      15.     public static void main(String[] args){  
      16.         Box myBox = new Box();  
      17.         myBox.setWidth(50);  
      18.         myBox.setHeight(30);  
      19.   
      20.         try{  
      21.             FileOutputStream fs = new FileOutputStream("foo.ser");  
      22.             ObjectOutputStream os =  new ObjectOutputStream(fs);  
      23.             os.writeObject(myBox);  
      24.             os.close();  
      25.         }catch(Exception ex){  
      26.             ex.printStackTrace();  
      27.         }  
      28.     }  
      29.       
      30. }  
  • 相关阅读:
    NSLayoutAttribute
    iOS自动布局
    UIView animateWithDuration 使用详解
    objective-c calendar 日历(2)
    objective-c calendar 日期
    ElasticSearch学习笔记
    PAT007 六度空间
    PAT006 Tree Traversals Again
    PAT005 Path in a Heap
    PAT004 Root of AVL Tree
  • 原文地址:https://www.cnblogs.com/myhome-1/p/5763681.html
Copyright © 2011-2022 走看看