不知道這段代碼有什麼問題,它爲什麼會終止?這段代碼有什麼問題?
public class task2 {
public static void main (String args []){
String str = "abc";
str = pad (str, 10, '*');
}
public static String pad(String base, int n, char c){
while (base.length()<n){
base = base +c;
}
return base;
}
}
下一次當你問一些關於某些代碼的問題時,請解釋一下你希望它做什麼_。任何代碼遲早會「終止」,這不是你的情況。 – gvlasov 2015-02-10 23:37:24