class LNode{
public int data;
public LNode next;
public LNode(int d){
data=d;
next=null;
}
public LNode(int d,LNode next){
data=d;
this.next=next;
}
}public class WashCards{
public static void main(String[] args){
LNode head=new LNode(1);
LNode w=head;
System.out.print(head.data+",");
for(int i=2;i<55;i++){
w=w.next;
w.data=i;
System.out.print(w.data+",");
}
}
}
public int data;
public LNode next;
public LNode(int d){
data=d;
next=null;
}
public LNode(int d,LNode next){
data=d;
this.next=next;
}
}public class WashCards{
public static void main(String[] args){
LNode head=new LNode(1);
LNode w=head;
System.out.print(head.data+",");
for(int i=2;i<55;i++){
w=w.next;
w.data=i;
System.out.print(w.data+",");
}
}
}
解决方案 »
- 编程求助
- [编程]应用缓冲区的思想,实现BufferedReader中的public int read()方法
- JS生成的文本框如何用Struts从JSP上面去得值
- java中socket服务端同时对连接中客户端下发数据方法
- comp = new Component(this);这里的this到底起了什么作用?
- 请教:如何用java语言实现把一段字符串中的字符从little-endian转换成big-endian顺序?
- 我生成的txt文件回车怎么不显示
- 求教:BS与CS的联系与区别。
- 高手请进
- 请教一个Swing的小需求的实现方案.
- 关于已知类名,创建该类的对象数组的问题?
- 麻烦找出几个错误的地方
+
w.next=new LNode(0);
就OK了。
public static void main(String[] args){
LNode w = new LNode(54);
for (int i = 54; --i > 0; w = new LNode(i, w));
LNode head = w;
while (w != null) {
System.out.print(w.data + ",");
w = w.next;
}
}
}例外,洗牌不叫wash,叫shuffle
LNode head = null;
for (int i = 54; i > 0; head = new LNode(i--, head));:P