- #1
Darkmisc
- 220
- 31
- TL;DR Summary
- I've been trying to teach myself Java but sometimes can't get the solutions to online problems to compile (both on Eclipse and online compilers).
Hi everyone
I've been trying to teach myself coding using the free materials from https://math.hws.edu/javanotes/index.html
I've been using online compilers because I got a "Error: Could not find or load main class" message immediately upon installing Eclipse.
The online compilers work for some solutions, but won't run others. https://www.programiz.com/java-programming/online-compiler/ is one such compiler. I've tried a few different ones and it seems they all run into problems when I try compile code that uses
- TextIO
- The following code:
The compilers sometimes work if I use Scanner instead of TextIO or "case x:" instead of "case x ->", but not every compiler will do this and I don't know why.
Can anyone recommend an online compiler that will run with TextIO and "case x ->" notation?
Thanks
I've been trying to teach myself coding using the free materials from https://math.hws.edu/javanotes/index.html
I've been using online compilers because I got a "Error: Could not find or load main class" message immediately upon installing Eclipse.
The online compilers work for some solutions, but won't run others. https://www.programiz.com/java-programming/online-compiler/ is one such compiler. I've tried a few different ones and it seems they all run into problems when I try compile code that uses
- TextIO
- The following code:
Java:
switch (operator) {
case '+' -> value = firstNum + secondNum;
case '-' -> value = firstNum - secondNum;
case '*' -> value = firstNum * secondNum;
case '/' -> value = firstNum / secondNum;
default -> {
System.out.println("Unknown operator: " + operator);
continue; // Back to start of loop!
}
} // end switch
Can anyone recommend an online compiler that will run with TextIO and "case x ->" notation?
Thanks
Last edited by a moderator: