基本上,我应该获得用户输入的名称列表。我已经摔倒了,看起来像这样。
public class TryAgain
{
static Node load () throws IOException
{
BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in));
Node node, head;
head = null;
node = null;
String names;
names = "";
while (!names.equals ("fin"))
{
System.out.print ("What is the name of the contestants? Enter \"fin\" to end. ");
names = stdin.readLine ();
node = new Node ();
node.data = names;
node.next = head;
}
return node;
}
public static void main (String str[]) throws IOException
{
Node head, BUhead;
head = load ();
}
}
下一部分实际上是让我兴奋的地方,我应该将列表备份到方法中的另一个无限节点列表中,并且列表每次都返回顶部。如果有人可以解释我应该怎么做,我将非常感激。