我对贾瓦有一个相当简单的问题。 我目前正在学习贾瓦语,我的家事问题之一被搁置。 目标是建立一个小三角区,少有。 然而,我认为我的想法已经淡化,我无法从谎言中得出走向正确的全部数字。
我迄今为止的法典是:
public class LittleGuy {
public static final int NUMBER_OF_GUYS = 5; // determines the number of guys.
public static void main(String[] args) {
for (int line = 1; line <= NUMBER_OF_GUYS; line++){
for (int j = 1; j <= (-5 * line + 25); j++){// uses the algorithm.
System.out.print(" ");
}
guy();
}
}
public static void guy(){
System.out.print(" o ******
/|\ *
/ \ *");
System.out.println();
}
}
基本上,尸体和头部应该分开。 我很麻烦地把他们放在一起。 我假定,这是我不了解或完全忽视的简单固定办法。 任何信息或想法都会受到高度赞赏。 再次感谢。