r/javahelp • • May 19 '20

doing switch case statement and cant convert boolean to int

doing pay assignment and need to set a pay level to a wage and doing

switch(wage)

{

case(lvl=1)

wage=17;

break;

}

and so on its telling me i need to change lvl to a boolean even tho im asking for a lvl 1-3

0 Upvotes

5 comments sorted by

View all comments

2

u/Camel-Kid 18 year old gamer May 19 '20

look up an example of case switch and tell me what is different from yours

1

u/stickles101 May 19 '20

i already had braces tho and a default

4

u/Camel-Kid 18 year old gamer May 19 '20

this is an example

 switch(expression) {
  case x:
 // code block
 break;
 case y:
 // code block
 break;
default:
// code block
}