您好我试图创建两个空整数数组来保存最多100个整数,这些整数从键盘读取,直到用户输入0
(零)。我需要打印出以下内容:
到目前为止,我有这个:
import java.util.Scanner;
public class CommonArrays {
public static void main(String[] args) {
//int values2[] = new int[3];
//int values2[] = new int[3];
final int LENGTH = 100;
int[] values = new int[LENGTH];
//int currentSize = 0;
fillArray(values);
Scanner in = new Scanner(System.in);
for(int y: values)
System.out.print(y);
/*while(in.hasNextInt()){
if(currentSize < values.length){
values[currentSize] = in.nextInt();
currentSize++;
}
for(int i = 0; i < currentSize; i++){
System.out.println(values[i]);
}
}
**/
}
public static void fillArray(int x[])
{
for(int counter = 0; counter < x.length; counter++)
x[counter]+=2;
}
public static void displayElement()
{
}
public static void displayCommon()
{
}
public static void displayNonCommon()
{
}
}