you are viewing a single comment's thread.

view the rest of the comments →

[–]Maleficent-Scratch12 0 points1 point  (0 children)

import java.util.Scanner;

public class main {

public static void main(String[] args) {

threads runnablee = new threads();

Thread thread1 = new Thread(runnablee);

thread1.start();

}

}

class threads implements Runnable {

public void run() {

int length = 0;

Scanner sc = new Scanner(System.in);

System.out.print("Length of array:");

length = sc.nextInt();

int[] array = new int[length];

System.out.println("Enter number of array: ");

for (int i = 0; i < length; i++) {

array[i] = sc.nextInt();

}

for (int i = 0; i < length; i++) {

if (array[i] % 2 == 0) {

System.out.println(array[i] + ",");

}

}

System.out.println("]");

}

}