This site requires JavaScript, please enable it in your browser!
Greenfoot back
Gabe1098
Gabe1098 wrote ...

2021/7/10

More Colored Code Quiestions

Gabe1098 Gabe1098

2021/7/10

#
What do these things mean? 1: throw 2: switch 3: case 4: default
Gabe1098 Gabe1098

2021/7/10

#
And 5: long
danpost danpost

2021/7/11

#
Gabe1098 wrote...
What do these things mean? 1: throw 2: switch 3: case 4: default ... And 5: long
(1) "throw": initiates an error routine (thru code, rather than by being caught); (2) (3) & (4) "switch"/"case"/"default": related keywords in a program flow construct; "switch" is the name of the construct and provides a variable; each "case" provides a possible value for the variable (if value of variable is the case's value, the code following that case executes); and "default" encompasses any value not already provided thru the cases. A "break" statement is normally used after the code of each case. However, there are exceptions where two or more cases would execute the same codes.
Gabe1098 Gabe1098

2021/7/11

#
danpost wrote...
Gabe1098 wrote...
What do these things mean? 1: throw 2: switch 3: case 4: default ... And 5: long
(1) "throw": initiates an error routine (thru code, rather than by being caught); (2) (3) & (4) "switch"/"case"/"default": related keywords in a program flow construct; "switch" is the name of the construct and provides a variable; each "case" provides a possible value for the variable (if value of variable is the case's value, the code following that case executes); and "default" encompasses any value not already provided thru the cases. A "break" statement is normally used after the code of each case. However, there are exceptions where two or more cases would execute the same codes.
Thanks! what about "short, long, byte, float, char"
danpost danpost

2021/7/12

#
Gabe1098 wrote...
what about "short, long, byte, float, char"
They are all different primary types. See this page of the java tutorials.
You need to login to post a reply.