Ask coding questions

← Back to all posts
Using scanner in a switch statement but my program is printing the default
cloudytech

I am a college freshman who's studying programming, so apparently, I'm new to this, but I'm already at the part of switch statements. I used the software by reading a blog on best IDE where it covers all the software.

The goal of my program is to be like a dictionary. When a user enters the term, the program should enter its meaning. But my program keeps printing the default. What do you think am I missing? Here's my code:

Sorry, if it's a lengthy program, I want to make it as ten items as possible. I also forgot to tell you that I tried once to remove the Scanner and only declare the variables, the program worked (just for you to know that my program also works and print strings).

Voters
cloudytech
Comments
hotnewtop
19ecal

As far as I can see it is working fine.
I presume that above your pasted code you have

or something similar

SixBeeps

Could you do us a favor and paste that code into the Java Repl you linked? Thanks ^^

19ecal

@SixBeeps just use vim to edit the temporary copy of the repl we actually see from the shell