如果 ud = u , du = d , uu = d , dd = u
如果我得到输出“uu du ud”有没有办法得到这样的输出
uu du ud ---Output already got
d d u ---Because uu=d du=d ud=u
u u ---Because dd=u and the other u comes down
d ---finally uu=d so the output is d.
我在获得这种输出时遇到问题,因为我不太了解 java。我写的代码是
public class Test
{
public static void main(String[] args)
{
int count = 0;
int index = 0;
Scanner scan = new Scanner(System.in);
System.out.print("How many Line Paremeters?");
int amount = scan.nextInt();
// One array to hold all the names
String[] name = new String[amount];
System.out.print("You entered "
+ amount + " as the size of your name list.");
System.out.println(" ");
// Ask for all the names
for (index = 0; index < amount; index++)
{
System.out.print("Enter Line Paremeters: ");
name[index] = scan.next();
}
System.out.println(" ");
System.out.println("The order: ");
System.out.println(" ");
System.out.println();
for (String names1 : name)
{
System.out.print(names1 + " ");
}
}
}