rendered paste bodyimport java.util.*;
public class test
{
public static void main(String[] args)
{
Exceptions e1 = new Exceptions();
boolean state = true;
while(state)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter numbers: ");
String str1 = input.nextLine();
String[] str2 = str1.split(" ");
int[] numbers = new int[str2.length];
for (int i=0; i< 1 3numbers.length; i++)
numbers[i] = Integer.parseInt(str2[i]);
if (e1.checkCard(numbers.length))
state = false;
//successful
//else fail, run a loop with the input again msg
}
}
}
================================================================================
import java.util.*;
public class Exceptions extends Exception
{
public Exceptions()
{
}
/*public void main(String[] args)
{
if(num > 5 || num <= 0)
{
System.out.println("An Incorrect input has been detected");
}
}*/
public static boolean checkCard(int num)
{
return (num > 3) ? false : true;
}
}