This program correctly works but it has this massive error code:
and when I hit verify, it the checkmarks and "X"s don't appear
error code:
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "exitVM.0")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkExit(SecurityManager.java:761)
at java.lang.Runtime.exit(Runtime.java:107)
at java.lang.System.exit(System.java:971)
at com.codegym.task.task04.task0419.Solution.main(Solution.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
package com.codegym.task.task04.task0419;
/*
Maximum of four numbers
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
//this section gets the keyboard input
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int c = input.nextInt();
int d = input.nextInt();
//this section compares the inputs
if (a >= b && a >= c && a >= d) //tests if "a" is the maximum
{
System.out.println(a);
System.exit(0);
}
if (b >= a && b >= c && b >= d) //tests if "b" is the maximum
{
System.out.println(b);
System.exit(0);
}
if (c >= a && c >= b && c >= d) //tests if "c" is the maximum
{
System.out.println(c);
System.exit(0);
}
if (d >= a && d >= b && d >= c) //tests if "d" is the maximum
{
System.out.println(d);
System.exit(0);
}
}
}