The Artima Developer Community
Sponsored Link

Java Answers Forum
Hi I'm new to java

3 replies on 1 page. Most recent reply: Jul 28, 2004 1:43 AM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
pat

Posts: 1
Nickname: n3m3
Registered: Jul, 2004

Hi I'm new to java Posted: Jul 27, 2004 2:56 PM
Reply to this message Reply
Advertisement
just wondering if you could nest an if statement w/in a switch case. and if you can how would it look?


Chris Dutton

Posts: 15
Nickname: cdutton
Registered: Jul, 2004

Re: Hi I'm new to java Posted: Jul 28, 2004 12:43 AM
Reply to this message Reply
Absolutely.

It might look something like:

switch (wooble) {
case 0:
if (fooBar == 42)
doSomething();
else
doSomethignElse();
break;
case 1:
doAnotherThing();
break;
}

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: Hi I'm new to java Posted: Jul 28, 2004 1:41 AM
Reply to this message Reply
One operator is missing in the post above:

switch (wooble) {
.
.
default:
doTheDefaultThing();
break;
}


Case only works with primitive types like int or char, but not with objects.

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: Hi I'm new to java Posted: Jul 28, 2004 1:43 AM
Reply to this message Reply
please forget my previous post. I completely misunderstood the question.

Flat View: This topic has 3 replies on 1 page
Topic: cutText Method Previous Topic   Next Topic Topic: running batch files from java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use