Hi,
This code works fine in Intellij, but fails to run in the web applet. When I try to run it manually, I get the following exception:
com.javarush.task.common.model.execution.UnhandledException: java.lang.ClassNotFoundException: com.javarush.task.task04.task0429.Solution
at com.javarush.task.common.model.execution.ExecuteService.execute(ExecuteService.java:107)
at com.javarush.task.app.execution.ExecutionService.execute(ExecutionService.java:107)
at com.javarush.task.app.execution.ExecutionService.main(ExecutionService.java:244)
at com.javarush.task.app.MainApplication.main(MainApplication.java:49)
Caused by: java.lang.ClassNotFoundException: com.javarush.task.task04.task0429.Solution
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.javarush.task.common.model.execution.ExecuteService.detectMainMethod(ExecuteService.java:51)
at com.javarush.task.common.model.execution.ExecuteService.execute(ExecuteService.java:99)
... 3 more
The same thing happens if I replace Scanner with BufferedReader.
Any idea ?package com.codegym.task.task04.task0428;
/*
Positive number
*/
import java.io.*;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
int[] numbers = new int[3];
numbers[0] = scanner.nextInt();
numbers[1] = scanner.nextInt();
numbers[2] = scanner.nextInt();
int c = 0;
int pos_count = 0;
int neg_count = 0;
while (c < 3)
{
if (numbers[c] > 0)
pos_count++;
else if(numbers[c] < 0)
neg_count++;
c++;
}
System.out.println("Number of negative numbers: " + neg_count);
System.out.println("Number of positive numbers: " + pos_count);
}
}