Switch is a reserved word in Java. Used for the switch … case construct.
You have named your method switch, which is not allowed.
The first group of errors you are getting are because when you use j = switch(j), it sees the word switch as the start of a switch construct and then tells you that switch(j) is not a valid way of using it.
Then the second group of errros you are seeing is that t sees that you have started to declare a method, but you haven’t given it a name. Of course you have – you have called it switch. But it doesn’t see the word ‘switch’ as a function name.
Then it just goes downhill from there.
solved Java – what should be basic stuff is giving errors every line [closed]