-1

How do you use the switch statement in Java? I'm a complete beginner.

I've worked with Javascript when designing web sites, so I have some very basic programming experience.

Dan Esparza
  • 28,047
  • 29
  • 99
  • 127
naveencgr8
  • 331
  • 1
  • 4
  • 13

2 Answers2

1

but when I'm writing codes in this software I feel something similar to JAVA coding

That is because you are writing Java, since BlueJ is nothing that an IDE for Java, not a language. So, answering your question, if you want a switch statement, write a Java switch statement:

switch (variable) {
    case option1:
        //code
    break;
    case option2:
        //other code
    break;
}
Agustin Meriles
  • 4,866
  • 3
  • 29
  • 44
0

Thanks you guys for telling me that BLUEJ is an IDE for JAVA, then I started searching for JAVA switch statement.

I found an article with simple examples that would explain to any beginner like me what is SWITCH statement.

http://www.homeandlearn.co.uk/java/java_switch_statements.html

Thanks everyone for your answers and valuable time.

naveencgr8
  • 331
  • 1
  • 4
  • 13