Skip to content
Errors which I don't understand the origin of
Profile icon
dragonwarp

I know effectively nothing about Java, so, sorry if this is simple and a mistake which should not be made. I am trying to learn Java, and I am currently working on trying to understand the switch command, and this is my work in doing so:
https://repl.it/@dragonwarp/A-random-Java-test-area

However, whenever I run it, I get an "illegal start of type" on line 4, an "Identifier expected" on the same line, and a "orphaned case" on case 1, and I have no idea why these errors are showing up. I've looked through multiple other posts on many sites similar to this problem, but none of the solutions I have seen have worked.

(the code is supposed to be a very simple input a number and get a string based on that number, so that It can just be a place where I can learn how to use the switch command)

You are viewing a single comment. View All
Profile icon
kurrycat2004

public static void main is a function. Just replace the ; at the end of line 2 with a { and also put a } at the end. Then it should work fine