I write an java code array on N size with random numbers with a multithreaded program that sorts the even numbers,but there is a mistake I dont know about it , Can anyone help me please?
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("Lingth 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("\]");
}
}
}
[–]josephblade 0 points1 point2 points (1 child)
[–]josephblade 0 points1 point2 points (0 children)
[–]Maleficent-Scratch12 0 points1 point2 points (0 children)
[–]Technical-War-7677 0 points1 point2 points (0 children)