This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Selection Statements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Selection Statements" Watch "Selection Statements" New topic

Selection Statements

Javix Protocol
Ranch Hand

Joined: Mar 21, 2000
Posts: 57
public class witch {
public static void main(String args[]) {
byte b = 100;
case 100:
case 200:
case 300:

Why there is compiler error??Maha anna specify please!

The Javix

Write Once , Run Anytime ,Anywhere Forever And Smile Happily.
Ranch Hand

Joined: Apr 20, 2000
Posts: 50
Problem comes with the value you are using in the last two case statements.The range of values for byte is between -128 and 127.
If you remove those two case statements or give values within the range of byte, the code will compile.

I agree. Here's the link:
subject: Selection Statements
It's not a secret anymore!