Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 System.in.read()输入int后print怎么变了?
netfsy





发贴: 4
积分: 0
于 2004-12-09 10:24 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
class readtext
{
  public static void main(String args[])
  {
    int ch;
    ch=1;
    System.out.println("Enter a number:");
    try
    {
      ch=System.in.read();
      }
    catch(Exception e)
    {
      System.out.println("Cannot read:"+ch);
      }
    System.out.println("The nember is:"+ch);输出的总是其他的数字
    System.out.println("The character is:"+(char)ch);输出的是我输入的数字,该是字符吧
    }
  }





话题树型展开
人气 标题 作者 字数 发贴时间
6581 System.in.read()输入int后print怎么变了? netfsy 377 2004-12-09 10:24
5382 Re:System.in.read()输入int后print怎么变了? netfsy 35 2004-12-09 10:56
5444 Re:System.in.read()输入int后print怎么变了? vainglory 920 2004-12-09 16:41
5401 Re:System.in.read()输入int后print怎么变了? netfsy 73 2004-12-10 15:03
5472 Re:System.in.read()输入int后print怎么变了? ch_tj2k 40 2004-12-10 17:30
5576 Re:System.in.read()输入int后print怎么变了? plam 41 2004-12-11 18:53

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923