課程
/后端開發
/Java
/Java入門第一季(IDEA工具)升級版
請教大佬們,數組怎么往里添加偶數并排序
2020-03-15
源自:Java入門第一季(IDEA工具)升級版 6-5
正在回答
package helloWorld;
public class notOdd {
public static void main(String[] args) {
int[] array={25,46,39,75,89,26,100};
System.out.println("輸出:");
notOdd hello=new notOdd();
hello.range(array);
}
public void range(int[] array){
int num=0;
for(int i=0;i<array.length||num>0;i++){
if(array[i]%2!=0){
continue;
num++;
System.out.println(array[i]);
舉報
0基礎萌新入門第一課,從Java環境搭建、工具使用、基礎語法開始
1 回答數組中有小數冒泡排序怎么寫???
4 回答數組排序問題
2 回答數組排序 輸出問題
3 回答關于數組排序求解~~
3 回答怎么偶數啊啊
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2020-03-16
package helloWorld;
public class notOdd {
public static void main(String[] args) {
int[] array={25,46,39,75,89,26,100};
System.out.println("輸出:");
notOdd hello=new notOdd();
hello.range(array);
}
public void range(int[] array){
int num=0;
for(int i=0;i<array.length||num>0;i++){
if(array[i]%2!=0){
continue;
}
num++;
System.out.println(array[i]);
}
}
}