一位码农写给妻子的代码

一位码农写给老婆的代码

 

public class 给最爱的老婆 {    
 // 老婆是私有,全局唯一,不可更改继承的
 private static final class 老婆 {        
  // 老婆,\r 代表换行     
  private static final String 漂亮等级 = "世界上最美丽的\r";   
  private static final String 温柔等级 = "世界上最温柔的\r";     
  private static final String 勤劳等级 = "世界上最勤劳的\r";   
  private static final String 善良等级 = "世界上最善良的\r";    
  private static final String 可爱等级 = "世界上最可爱的\r";     
  private static final String 懂我等级 = "世界上最懂我的\r";     
  private static final String 疼我等级 = "世界上最疼我的\r";      
  private static final String 照顾我等级 = "世界上最精心照顾我的\r"; 
  private static final String 对我的意义 = "你是我一生最爱的人\r";       
  // 老婆是不能构造的,只能迎娶     
  private 老婆() {         }      
  private static final 老婆 marryMe() {       
   return new 老婆();       
   }        
  private boolean 笑() {       
   System.out.println("老婆笑了:)");      
   return true;     
   }        
  private boolean 哭() {        
   System.out.println("呜呜,老婆伤心了。");      
   return true;      
   }        
  private boolean 不在家() {          
   System.out.println("老婆不在家。");     
   return true;       
   }          
  private void 生气了() {       
   throw new 老婆很生气Exception("老婆今天很生气,不爱理你。");   
   }         
  private void 破涕为笑() {        
   System.out.println("老婆破涕为笑。");    
   }         
  @Override    
  public String toString() {       
   return "老婆你是:\r" + 漂亮等级 + 温柔等级 + 勤劳等级 + 善良等级 + 可爱等级   + "你也是:\r" + 懂我等级 + 疼我等级 + 照顾我等级 + "总之,\r" + 对我的意义;         }       }   
 /*      * 老婆很生气异常      */ 
   private static final class 老婆很生气Exception extends RuntimeException {     
  private static final long serialVersionUID = 7260098074598571319L;    
  private 老婆很生气Exception(String msg) {       
   super(msg);    
   }   
  }    
   @SuppressWarnings("unused")  
   public static void main(String[] args) {   
    老婆 myWife = 老婆.marryMe();      
    System.out.println("老婆,首先我想对你说:" + myWife);    
    System.out.println("如果你笑,");      
    if (myWife.笑()) {         
     System.out.println("我更加高兴。\r");     
     }       
    System.out.println("如果你哭,");     
    if (myWife.哭()) {        
     System.out.println("我哄你笑。\r");    
     }         
    if (myWife.不在家()) {      
     System.out.println("我就很难入睡。\r");      
     }        
    System.out.println("生活中难免有琐碎、摩擦。");     
    try {        
     myWife.生气了();     
     } catch (老婆很生气Exception e) {      
      System.out.println(e.getMessage());        
      System.out.println("都是我的错,是我不好。请老婆不要生气。");     
      } finally {           
       System.out.println("直到....");     
       myWife.破涕为笑();           
       // 为了空行      
       System.out.println();      
       }       
      int myAge = 28;      
      // 爱你一万年      
      while (myAge <= 10028) {       
       boolean 我是否爱你 = true;        
       myAge++;      
       }        
      System.out.println("希望能就这样平平静静的牵你手,一直走。");    
      System.out.println("我爱你,我的老婆。");    
      System.out.println("\t ——你的老公于:2012年5月25日晚");  
      }  
  }
 
12楼xiaowei_cqu前天 19:11
程序猿的诗
11楼han_yankun2009前天 15:25
很有创意
10楼liutengteng130前天 10:29
很不错,有意思。
9楼as19901130前天 10:29
很有意思啊
8楼hejingyuan6前天 08:22
呵呵,好玩
7楼han_yankun2009前天 01:33
不错
6楼happy09li前天 20:33
[code=csharp]n要是他老婆不懂程序,那就是“无字天书”了n[/code]
5楼liujiahan6296293天前 19:58
有创意!
4楼sx5643129743天前 19:06
有意思...
3楼lishehe3天前 17:02
呵呵,不错
2楼Wentasy3天前 17:01
哈哈!程序员的思维。
1楼chow__zh3天前 16:22
此程序运行结果:n老婆,首先我想对你说:老婆你是:n世界上最美丽的n世界上最温柔的n世界上最勤劳的n世界上最善良的n世界上最可爱的n你也是:n世界上最懂我的n世界上最疼我的n世界上最精心照顾我的n总之,n你是我一生最爱的人nn如果你笑,n老婆笑了:)n我更加高兴。nn如果你哭,n呜呜,老婆伤心了。n我哄你笑。nn老婆不在家。n我就很难入睡。nn生活中难免有琐碎、摩擦。n老婆今天很生气,不爱理你。n都是我的错,是我不好。请老婆不要生气。n直到....n老婆破涕为笑。nn希望能就这样平平静静的牵你手,一直走。n我爱你,我的老婆。nt ——你的老公于:2012年5月25日晚