輸出怎么換行
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]);
? ? ? ? ? ?}
? ? ? ? }
? ??
? ? }
}
我現(xiàn)在輸出是 ? 考試成績的前三名為: 91 89 73
怎么改才能變?yōu)?? ?考試成績的前三名為:
? ? ? ? ? ? ? ? ? ? ? ? ? 91
? ? ? ? ? ? ? ? ? ? ? ? ? 89
? ? ? ? ? ? ? ? ? ? ? ? ? 73
求大神解答
2015-11-07
網(wǎng)站的問題,在本地運(yùn)行System.out.println確實(shí)會(huì)換行