Home > Back-end >  Java array
Java array

Time:10-29

Ask everyone a great god who can teach how to write, need
Define an array of int [] s, initialization value, loop determine whether odd number and output

CodePudding user response:

Not sure the length of the input, you why want to use an array?

CodePudding user response:

reference 1st floor a2305855118 response:
not sure the length of the input, you why want to use an array?

Regulation is an array, arbitrary length

CodePudding user response:


Int test []={1, 2, 3, 4, 5};
for (int i=0; i If ((test [I] % 2)==1) {
System. The out. Println (test [I]);
}
}

CodePudding user response:

references of big banyan tree little dream reply:
int test []={1, 2, 3, 4, 5};
for (int i=0; i If ((test [I] % 2)==1) {
System. The out. Println (test [I]);
}
}

Thank you thank you thank you

CodePudding user response:

//coquettish write
Public static void main (String [] args) {
324,54,877,213,687,7678,32121,4546,6876,214,769,9879,423432,657 Integer [] arrays={};
Arrays.aslist (Arrays). The stream (). The forEach (e - & gt; {
If (e % 2==0) {
System. The out. Println (e + "is an even number");
} else {
System. The out. Println (e + "is an odd number of");
}
});
}

CodePudding user response:

Simple notation//
Public static void main (String [] args) {
324,54,877,213,687,7678,32121,4546,6876,214,769,9879,423432,657 Integer [] arrays={};
for (int i=0; i If (arrays [I] % 2==0) {
System. Out. Println (arrays [I] + "is an even number");
} else {
System. The out. Println (arrays [I] + "is an odd number of");
}
}
}

CodePudding user response:

Don't mention it, have given points

CodePudding user response:

Well well well thank

CodePudding user response:

You count not their input

CodePudding user response:

What can be the input you want