之前用语句

int b = 2;

char c = (char) b;

System.out.println( c );

会无法输出数字2,而是像一个比“口”字还小的一个框,

 

正确的方法(但不一定是最优的)

 

   1:  public class menglei {
   2:      public static void main(String[] args ){
   3:          
   4:          int b = 4;
   5:          String s = String.valueOf(b);
   6:          char c = s.charAt(0);
   7:          System.out.println(c);
   8:          
   9:      }
  10:  }

 

问题就得到解决了微笑

posted on 2012-08-29 21:38  _兜  阅读(20176)  评论(4编辑  收藏  举报