c struct java 实现

1476阅读 0评论2011-12-28 cnljh
分类:Java

    以下代码由CSDN论坛复制
  1. //规则
  2. struct rule{
  3. char x;
  4. int y;
  5. }rul[6]={{'E',3},{'E',1},{'T',3},{'T',1},{'F',3},{'F',1}};

 

  1. class Rule{
  2.         public char x;
  3.         public int y;
  4.         Rule(char x,int y){
  5.             this.x=x;
  6.             this.y=y;
  7.         }
  8.     }

  9. class Rual{
  10.     public static Rule ru[]=new Rule[6];
  11.     public static void main(String[] args) {
  12.         ru[0]=new Rule('E',3);
  13.         ru[1]=new Rule('E',1);
  14.         ru[2]=new Rule('T',3);
  15.         ru[3]=new Rule('T',1);
  16.         ru[4]=new Rule('F',3);
  17.         ru[5]=new Rule('F',1);
  18.     }

  19. }
上一篇:在两个Activity之间传递对象
下一篇:Android TTS学习