Topic: 帮我看看那错了呀? |
Print this page |
1.帮我看看那错了呀? | Copy to clipboard |
Posted by: ruoruowudi Posted on: 2005-09-25 10:55 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(); } } } |
2.Re:帮我看看那错了呀? [Re: ruoruowudi] | Copy to clipboard |
Posted by: why Posted on: 2005-09-25 11:54 請閣下先說說出現甚麼錯 |
3.Re:帮我看看那错了呀? [Re: ruoruowudi] | Copy to clipboard |
Posted by: ruoruowudi Posted on: 2005-09-25 13:06 就这样 |
4.Re:帮我看看那错了呀? [Re: ruoruowudi] | Copy to clipboard |
Posted by: why Posted on: 2005-09-25 20:33 不必貼圖,把Command Prompt中的內容剪貼上來方便得多 > next.getNext()=new Cjxt(); 閣下怎様想出這種句法?! 請找本入門書好好讀讀! 閣下要的是
// and replace // next.getNext()=new Cjxt(); // with next.setNext(new Cjxt()); 其他的自己改正吧 请尽量使用准确的文字描述作为标题 若新帖再無恰当标题,可能会被刪除 想不到合适的标题,就用error message也好: 帮我看看那错了(unexpected type) |
5.Re:帮我看看那错了呀? [Re: ruoruowudi] | Copy to clipboard |
Posted by: ruoruowudi Posted on: 2005-09-25 21:13 晕,我知道我问的问题很傻,但你也不用这么直呀!不过这你次的回复我没看懂呀。。 对于你说的书,我看了几本,不过效果不好呀,要不你推荐一本吧。。 |
6.Re:帮我看看那错了呀? [Re: ruoruowudi] | Copy to clipboard |
Posted by: why Posted on: 2005-09-25 21:34 ruoruowudi wrote: 敝人說甚麼书 閣下看了那几本 效果怎样不好 閣下不說,我們如何介紹?! 剛才的回覆把this寫了the,修正了 敝人幹啥要彎著思路說? 怕傷害閣下的心靈嗎? 敝人現在還是要直說:看了几本书,竟然可以創造(胡混)出這样的句法,請不要說书是敝人推荐的. |
7.Re:帮我看看那错了呀? [Re: ruoruowudi] | Copy to clipboard |
Posted by: bluecrystal Posted on: 2005-09-26 13:09 可参看java 语法规范的这一节 15.26 Assignment Operators |
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 |