生活随笔
收集整理的這篇文章主要介紹了
Java逐行打印
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
逐行輸出打印
package com.example;import java.util.Scanner;
public class Main08 {public static void main(String[] args
) {Scanner sc
= new Scanner(System.in
);int m
= sc
.nextInt();int n
= sc
.nextInt();int[][] nums1
= new int[m
][n
]; for(int i
=0;i
<m
;i
++){for(int j
=0;j
<n
;j
++){nums1
[i
][j
] = sc
.nextInt();}}int[][] nums2
= new int[m
][n
]; for(int i
=0;i
<m
;i
++){for(int j
=0;j
<n
;j
++){nums2
[i
][j
] = sc
.nextInt();}}int[][] res
= new int[m
][n
];for(int i
=0;i
<m
;i
++){for(int j
=0;j
<n
;j
++){res
[i
][j
] = nums1
[i
][j
] + nums2
[i
][j
] * 2 - 255;if(res
[i
][j
] < 0){res
[i
][j
] = 0;}else if(res
[i
][j
] > 255){res
[i
][j
] = 255;}else{res
[i
][j
] = res
[i
][j
];}System.out
.print(res
[i
][j
]);System.out
.print(" ");}System.out
.println();}}
}
總結
以上是生活随笔為你收集整理的Java逐行打印的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。