aspose file tools*
The moose likes Beginning Java and the fly likes Switch Statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Switch Statement" Watch "Switch Statement" New topic
Author

Switch Statement

Bryan Peach
Ranch Hand

Joined: Sep 08, 2009
Posts: 76
hey.. I am trying to build this switch statement but i keep getting this error
action is already defined in main(java.lang.String[])


I have tried different variable names but keep getting the same error.. can anyone help?
I know the code might look alittle rough as i am not done yet... but i'm just concerned with getting the switch working first... thanks.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18836
    
  40

You declared the action local variable twice (in the same method). Once at line 67. And the other at line 80.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Bryan Peach
Ranch Hand

Joined: Sep 08, 2009
Posts: 76
hahaha geez... thank you don't i feel stupid.
If i wanted to have the switch statement set up so that i keep coming back to it how would i do that? A loop? I want to be able to choose the first action.. setSize and then return to the switch so that i may choose another option.. Is that simply a loop and if so where would I loop it?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Switch Statement