M
M
MixidFinder2019-07-01 01:35:30
Java
MixidFinder, 2019-07-01 01:35:30

Why can't java code be executed in sublime text?

The builder says:

{
   "shell_cmd": "javac \"$file\" && java \"$file_base_name\"",
   "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
   "path": "C:\\Program Files\\Java\\jdk1.8.0_211\\bin",
   "shell":true
}

Simple programs like "Hello world" work fine, but similar ones:
public static void main(String[] args) throws Exception {
        ArrayList<Integer> list0 = new ArrayList<>();
        ArrayList<Integer> list1 = new ArrayList<>();
        ArrayList<Integer> list2 = new ArrayList<>();
        ArrayList<Integer> list3 = new ArrayList<>();
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        for (int i = 0; i < 20; i++) {
            list0.add(Integer.parseInt(reader.readLine()));
        }
        for (int i = 0; i < list0.size(); i++) {
            if (list0.get(i) % 3 == 0) list1.add(list0.get(i));
            if (list0.get(i) % 2 == 0) list2.add(list0.get(i));
            if ((list0.get(i) % 3 != 0) & (list0.get(i) % 2 != 0)) list3.add(list0.get(i));
        }
        printList(list1);
        printList(list2);
        printList(list3);
    }


    public static void printList(ArrayList<Integer> list) {
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }

They don’t want to, they seem to be going to, but they don’t want to display anything, it feels like they either work endlessly, or who knows what, no errors. How can this bug be solved?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question