[英]Java recursive method to print one word in a string at a time without loops
[英]I need to make a string triangle with for loops taking off one letter of the word each time. Java
我一直在编写代码,但是我只能在输出中得到一个带有我输入的单词的框。例如,我需要输入单词“ hippo”来制作形状
到目前为止,这是我在for循环上所做的。
for(int i = length; i > 0 ; i--)
{
out.println(word);
}
我需要帮助。
在我的头顶上,循环看起来像这样。
for(int i = length - 1; i >= 0 ; i --) {
System.out.println(word.substring(0, i));
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.