错误信息是什么?

错误信息是什么?
for(;;){
这里用了死讯欢乐。 我就不信不出错
Out.println();我这边出错!不知道你用的啥。。。code有些可以借鉴,而且写得挺简单的。。但是主程序里你要打开文件.txt什么的。。我这边用你的代码太多错误,花那个时间看你的错误还不如自己编个新的而且由于整个思维方式不是俺的,俺又失去java灵感了。。都是颇sql弄得
这个是整个代码既有添加和删除的methoden, 那个array俺设成的是类的数组。。
而且也删除了那个micheln 就是代码里可能有冗余码。。
2分能给你1,5或者1分。。靠至少都运行了啊。。。用这个代码的话你们老师不给你分。。我在家诅咒他
/*
* Created on 2007-4-9
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package Test2;
/**
* @copyright
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class TesterLab02 {
public static void main(String[] args) {
Person [] p=new Person[3];LinkedList listTest2=new LinkedList();
p[0]=new Person("we","w","23w0w");
p[1]=new Person("2c "," 2d ", " 11-3-1999w1 ");
p[2]=new Person("Michael","Ballack","4324234");
listTest2.add(p[0]);listTest2.add(p[1]); listTest2.add(p[2]);
System.out.println(" ---------ADD Telephonnummer-------");
System.out.println(listTest2);
System.out.println(" ---------Loeschen Telephonnummer-------");
boolean l;
l=listTest2.remove(p[2]);
if(l) {System.out.println(p[2]+" geloescht \n ");
System.out.println("new Telephon Buch is ");}
else System.out.println(" nicht geloescht");
System.out.println(listTest2);
}
}
此篇文章于 09-05-15 23:59 被 星星点 编辑。
package Test2;
/*
* Created on 2007-4-8
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @copyright
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Person {
String firstName;
String lastName;
String telephon="";
Person(){
this("unknown", "unknown", "unknown");
}
Person(String firstName){
this(firstName, "unknown", "unknown");
}
Person(String firstName, String lastName){
this(firstName, lastName,"unknown");
}
Person(String firstName, String lastName, String telephon){
setFirstName(firstName);
setLastName(lastName);
setTelephon(telephon);
}
void setFirstName(String newfirstName){
this.firstName=newfirstName;
}
void setLastName(String newlastName){
this.lastName=newlastName;
}
void setTelephon(String newtelephon){
this.telephon=newtelephon;
}
String getFirstName(){
return firstName;
}
String getLastName(){
return lastName;
}
public String toString(){
return "\n" +
"firstName: " + firstName + " |\t\n" +
"lastName: " + lastName + " |\t\n" +
"Telephonnumer: " + telephon + " |\n";
}
}
package Test2;
/*
* Created on 2007-4-8
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @copyright
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class ListItem {
Person item;
ListItem next;
ListItem prev;
public ListItem(Person item){
if(item!=null) this.item=item;// create newperson 赋值给当前item;
}
ListItem getNext(){
return next;
}
ListItem getPrev(){
return prev;
}
Person getItem(){
return this.item;
}
void setNext(ListItem newNext){
this.next=newNext;
}
boolean hasNext(){
if(next!=null)return true;
else return false;
}
boolean hasPrev(){
if(prev!=null)return true;
else return false;
}
public void setItem(Person item){
this.item = item;
}
void setPrev(ListItem newPrev){
this.prev=newPrev;
}
public String toString(){
return item.toString();
}
}
package Test2;
/*
* Created on 2007-4-8
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @copyright
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class LinkedList {
ListItem first;
ListItem current;
ListItem last;
public LinkedList(){
}
public LinkedList(Person p){
add(p);
}
public LinkedList(Person[] pA){
for (int i = 0; i<pA.length; i++){
add(pA[i]);
}
}
public void add(Person newperson){
ListItem newItem = new ListItem(newperson);//listitem consturctor;
if (first==null){
first = newItem;
current = newItem;
last = newItem;
newItem.setPrev(null);
newItem.setNext(null);
} else {
last.setNext(newItem);//找到最后一个点,last.next赋值,如同,*p指针的next指向newitem。
newItem.setPrev(last);
last = newItem;//链的最后一个元素为newitem;
}
}
public boolean remove(Person person){
boolean removeold=false;
current=first;
while(current!=last){
if(current.item==person)
{if(current == first) {
first.getNext().setPrev(null);
first = first.getNext();
current = first;
} else if (current == last){
last.getPrev().setNext(null);
last = last.getPrev();
current = last;
} else {
current.getPrev().setNext(current.getNext());
current.getNext().setPrev(current.getPrev());
current = current.getNext();
}
removeold=true;break;
}
else {current=current.getNext();}
}
if(current==last&¤t.item==person){
removeold=true;
if (last ==first){
first = null;
last = null;
current = null;
} else{
last.getPrev().setNext(null);
last = last.getPrev();
current = last;
} }
return removeold;
}
public ListItem getFirst(){
if (first!=null){
current = first;
return first;
} else return null;
}
public ListItem getLast(){
if (last!=null){
current = last;
return last;
}
else return null;
}
public ListItem getNext(){
if (current.hasNext()){
current = current.getNext();
return current;
} else
return null;
}
public ListItem getPrev(){//yiqian de
if (current.hasPrev()){
current = current.getPrev();
return current;
} else
return null;
}
public String toString(){
String outString ="<TelephonVerzeichnis:>\n";
ListItem nextItem = first;
while (nextItem != null){
outString += nextItem.toString()+"\n";
nextItem = nextItem.getNext();
}
return outString + "</TelephonVerzeichnis:>\n";
}
}
够哥们吧。。请客把![]()
目前有1位用户正在查看此主题。(0 位会员和 1 游客)


书签