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

您没有登录

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

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 一个新手关于try的问题!
阿猫





发贴: 6
积分: 0
于 2004-10-04 22:06 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
不好意思,问题可能很没有水准!

在很多源码中看到这样的代码,不知道时做什么用的。
try {
s = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)).readLine();
}



作者 Re:一个新手关于try的问题! [Re:阿猫]
hvbird



发贴: 0
积分: 0
于 2004-10-04 23:53 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
输入一个一段字符串储存在s中!


作者 Re:一个新手关于try的问题! [Re:阿猫]
littledeer1974

Garbage Collector

CJSDN高级会员


发贴: 1517
积分: 122
于 2004-10-06 09:56 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
try {
s = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)).readLine();
}


试着做这件(s = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)).readLine();)事情,如果不成功的话,就告诉我们哪里有问题(应该还有catch{}部分的语句吧)

你还可以进一步的参照
http://java.sun.com/docs/books/tutorial/essential/exceptions/try.html


littledeer1974 edited on 2004-10-06 09:58

Surround yourself with people who are open to change

作者 Re:一个新手关于try的问题! [Re:阿猫]
zzgf16





发贴: 6
积分: 0
于 2004-10-06 14:28 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
语句的意识是接收一行键盘输入的字符串


作者 Re:一个新手关于try的问题! [Re:阿猫]
zzgf16





发贴: 6
积分: 0
于 2004-10-06 14:30 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
TRY是捕捉大括号内的代码如果出错的话怎么办,一般后面给着CATCH语句具体敬意如果出错了怎么办的代码


作者 Re:一个新手关于try的问题! [Re:阿猫]
cjyzpcl





发贴: 64
积分: 4
于 2004-10-10 03:02 user profilesend a private message to usersend email to cjyzpclsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
try内放得是有可能在运行时产生异常的代码,可以用catch捕获其中得异常,并做出相应的处理!


作者 Re:一个新手关于try的问题! [Re:阿猫]
dennisjl





发贴: 53
积分: 1
于 2004-10-10 14:08 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
这些问题可以看书, 任何一本基础书籍都会介绍得很清楚的。


作者 Re:一个新手关于try的问题! [Re:阿猫]
Blakeyu





发贴: 2
积分: 0
于 2004-10-11 20:30 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
应该看基础书先


作者 Re:一个新手关于try的问题! [Re:阿猫]
kudo





发贴: 15
积分: 0
于 2004-10-11 21:26 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
我也是新手,大家共同进步吧~!


作者 Re:一个新手关于try的问题! [Re:阿猫]
q_yuan





发贴: 174
积分: 3
于 2004-10-12 11:06 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
这是初学者常常碰到的问题!


作者 Re:一个新手关于try的问题! [Re:阿猫]
阿猫





发贴: 6
积分: 0
于 2004-10-12 11:49 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
谢谢大家!



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