[英]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.