如果UD = U,杜= d,UU = d,DD = U映射字符串他人在Java中
如果我得到的输出 “UU杜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 + " ");
}
}
}
这功课吗? –
标题,描述和代码是否有任何关系? – GriffeyDog
稍微的上下文可能会有所帮助...... –