Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4 all those years ago...)
Originally posted by priya varma:
From Khalid A. Mughal:
The first statement in the switch body must have a "case" label, or it is unreachable. This statement will never be executed since control can never be transferred to it. The compiler will flag this as an error.
But I think The first statement in the switch body must have a "case or default" label, or it is unreachable.....
The body of a switch statement is known as a switch block. Any statement
immediately contained by the switch block may be labeled with one or more case or default labels. These labels are said to be associated with the switch statement, as are the values of the constant expressions (�15.28) in the case labels.
Originally posted by Jeff Bosch:
The "default" case is still a case, you just don't use the word "case" before it.
Hope that helps!
Originally posted by pallavi pandey:
if(a>0)
if(a%2==0)
System.out.println(a + " is a positive even number");
-------
if(a>0)
System.out.println(a + " is a postive number");
else
System.out.println(a + " is a negative number");
--An if statement can have either an if clause or an else clause.
Originally posted by Harwinder Bhatia:
Something for the moderators to look into:
I cannot edit my previous post completely. When I click on the edit icon, it only displays the second half of my post starting from the [CODE] down to the end of the post (but not the first half). Looks like a bug to me ...
Thanks
Harwinder
What does a metric clock look like? I bet it is nothing like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|