| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 895 人关注过本帖
标题:按照视频教程的 一模一样但是 他没出错 我却出错了
取消只看楼主 加入收藏
wenxx10
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2008-8-4
收藏
 问题点数:0 回复次数:3 
按照视频教程的 一模一样但是 他没出错 我却出错了
class bl2
{
            public static void main(String [] args)
            {
                        int x=12;
                        {
                            if(x<3)
                            {
                                        System.out.println("x<3");
                                        System.out.println("ok");
                            }
                            else if(x>=3 && x<8)
                                        System.out.println("x>=3 && x<8");
                        }
              int y;            
                        /*if(x>0)
                                        y=x;
                        else
                                        y=-x;*/
                        y=x>0?x:-x;
                    
                        if(x==1)
                                    {
                                    if(y==1)
                                                {
                                                System.out.println("x==1,y==1");
                                                }
                                    else
                                            {
                                                System.out.println("x==1,y!=1");
                                         }
                                      }
                      else if(x>3)   
                                  {
                                  if(y==1)
                                    {
                                                System.out.println("x!=1,y==1");
                                    }
                                    else
                                    {
                                                System.out.println("x!=1,y!=1");
                                    }
                                    }
                        
                        x=1;
                        switch(x)
                        {
                                        case 1:
                                                        System.out.println("switch1");
                                                        break;
                                        case 2:
                                                        System.out.println("seitch2");
                                                        break;
                                        case 3:
                                        case 4:
                                                                        System.out.println("3,4");
                                                                        break;
                                        default:
                                                        System.out.println("other");
                        }
                        try
                        {      
                        x=System.in.read();
                          }
                          catch(Exception e){}
                        while(x!='q')
                        {
                                        System.out.println((char)x);
                                        x=System.in.read();  
                                             try
                                {      
                                x =System.in.read();
                                }
                                catch(Exception e){}
                                }     
            }
}

//编译时总是说 bl2.java:69: 未报告的异常 ;必须对其进行捕捉或声明以便抛出
                                                        x=System.in.read();
                                                                        ^
搜索更多相关主题的帖子: 视频 教程 一模一样 
2008-08-20 12:02
wenxx10
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2008-8-4
收藏
得分:0 
多谢   说详细些该怎样改呢?

[[it] 本帖最后由 wenxx10 于 2008-8-20 13:48 编辑 [/it]]
2008-08-20 13:47
wenxx10
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2008-8-4
收藏
得分:0 
xx  我也不懂视频上只是讲循环没将这个
2008-08-20 19:16
wenxx10
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2008-8-4
收藏
得分:0 
bl2.java:3: 找不到符号
符号: 类 IOException
位置: 类 bl2
            public static void main(String [] args) throws IOException
                                                           ^
1 错误
2008-08-20 19:19
快速回复:按照视频教程的 一模一样但是 他没出错 我却出错了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.044178 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved