輸出怎么換行
import java.util.Arrays;
public class HelloWorld
{
? ??
? ? //完成 main 方法
? ? public static void main(String[] args)?
? ? {
? ? ? ? int count=0;
? ? ? ? int[] scores={89,-23,64,91,119,52,73};
? ? ? ? HelloWorld hello=new HelloWorld();
? ? ? ? System.out.println("考試成績的前三名:");
? ? ? ? System.out.println();
? ? ? ? ?hello.love(scores);
? ? }
? ??
? ? //定義方法完成成績排序并輸出前三名的功能
? ??
? ? public void love(int [] scores)
? ? {
? ? ? ?int count=0;
? ? ? ? Arrays.sort(scores);
? ? ? ? for(int i=scores.length-1;i>=0;i--)
? ? ? ? {
? ? ? ? ?if(scores[i]>=0&&scores[i]<=100)
? ? ? ? ? ?{
? ? ? ? ?if(count>=3)
? ? ? ? ?break;
? ? ? ? ? count++;
? ? ? ? ? System.out.println(+scores[i]);
? ? ? ? ? ?}
? ? ? ? }
? ??
? ? }
}
我現在輸出是 ? 考試成績的前三名為: 91 89 73
怎么改才能變為 ? ?考試成績的前三名為:
? ? ? ? ? ? ? ? ? ? ? ? ? 91
? ? ? ? ? ? ? ? ? ? ? ? ? 89
? ? ? ? ? ? ? ? ? ? ? ? ? 73
求大神解答
2015-11-07
網站的問題,在本地運行System.out.println確實會換行