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

您没有登录

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

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 帮我看看那错了呀?
ruoruowudi





发贴: 17
积分: 0
于 2005-09-25 10:55 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
import java.io.*;
class Cjxt {
   static int count=0;
   private String name;
   private int maths;
   private Cjxt next=null;
   public String getName(){
     return(this.name);
  }
     public int getMaths(){
       return(this.maths);
     }
     public Cjxt getNext(){
       return(this.next);
     }
   public void ini(Cjxt pp){
      this.maths=pp.maths;
      this.name=pp.name;
      this.next=pp.next;
   }
}
class TestInPut
{
  static void inPut(Cjxt pp)
  {
    pp=new Cjxt();
    BufferedReader re=
    new BufferedReader(new InputStreamReader(System.in));
    System.out.println("输入姓名");
     try{
            pp.getName()=re.readLine();
         }catch(Exception e){System.out.println(e.getMessage());}                          
    System.out.println("输入数学成绩");  
   while(true)
    {  
      try
      {    
        pp.getMaths()=Integer.parseInt(re.readLine());
        break;             
      }
      catch(Exception e)
      {   
        System.out.println("输入非数字");
        System.out.println("从新来过");
      }
    }
  }      
}  
public class Test
{
  public static void main(String[] args)
   {  
     Cjxt next=new Cjxt();
     Cjxt head=next;
     BufferedReader re=new BufferedReader(new InputStreamReader(System.in));    
     while(true)
     {
      TestInPut.inPut(next);
      next.getNext()=new Cjxt();
      next=next.getNext();
      Cjxt.count++;  
      if(Cjxt.count==3)
       break;
     }              
    // TestDelete.delete(head);
     //TestInsert.insert(head);
     for(int i=0;i<Cjxt.count;i++)
     {
      System.out.println("maths="+head.getMaths()+" "+"name="+head.getName());
      head=head.getNext();  
     }
   }    
}



作者 Re:帮我看看那错了呀? [Re:ruoruowudi]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2005-09-25 11:54 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
請閣下先說說出現甚麼錯Smile


作者 Re:帮我看看那错了呀? [Re:ruoruowudi]
ruoruowudi





发贴: 17
积分: 0
于 2005-09-25 13: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:帮我看看那错了呀? [Re:ruoruowudi]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2005-09-25 20:33 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不必貼圖,把Command Prompt中的內容剪貼上來方便得多

> next.getNext()=new Cjxt();
閣下怎様想出這種句法?!
請找本入門書好好讀讀!

閣下要的是

class Cjxt {
...
public void setNext(Cjxt next) {
this.next = next;
}
...
// and other setXXX()s


// and replace
// next.getNext()=new Cjxt();
// with
next.setNext(new Cjxt());

其他的自己改正吧


请尽量使用准确的文字描述作为标题
若新帖再無恰当标题,可能会被刪除

想不到合适的标题,就用error message也好:
 帮我看看那错了(unexpected type)


why edited on 2005-09-25 21:28

作者 Re:帮我看看那错了呀? [Re:ruoruowudi]
ruoruowudi





发贴: 17
积分: 0
于 2005-09-25 21:13 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
晕,我知道我问的问题很傻,但你也不用这么直呀!不过这你次的回复我没看懂呀。。
对于你说的书,我看了几本,不过效果不好呀,要不你推荐一本吧。。


ruoruowudi edited on 2005-09-25 21:15

作者 Re:帮我看看那错了呀? [Re:ruoruowudi]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2005-09-25 21:34 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
ruoruowudi wrote:
晕,我知道我问的问题很傻,但你也不用这么直呀!不过这你次的回复我没看懂呀。。
对于你说的书,我看了几本,不过效果不好呀,要不你推荐一本吧。。

敝人說甚麼书
閣下看了那几本
效果怎样不好

閣下不說,我們如何介紹?!

剛才的回覆把this寫了the,修正了

敝人幹啥要彎著思路說?
怕傷害閣下的心靈嗎?
敝人現在還是要直說:看了几本书,竟然可以創造(胡混)出這样的句法,請不要說书是敝人推荐的.



作者 Re:帮我看看那错了呀? [Re:ruoruowudi]
bluecrystal





发贴: 2788991
积分: 48
于 2005-09-26 13:09 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
可参看java 语法规范的这一节

15.26 Assignment Operators



Just Software & Travel
-- 我的blog -- 技术点滴/经验分享

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