• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Legal Arguments for If Statements

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was playing a bit with an example in K&B's exam book (page 215. i think the sample in the book misses a closing paranthesis).
A slight variant of the sample is given below:

When I run this code, the output is:
true-1
true-2
true-3
I wonder why "true-4" is not printed
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Unni,
When I run this code it does print all four lines...
Alex

 
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Unni,
I just copied and pased that code into a test class and it does print all:
C:\tmp>java Test
true-1
true-2
true-3
true-4
C:\tmp>
 
Unni Kainila
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Friends,
Looks like my java IDE problem. It is using jdk1.3 too!
I compiled and run it from command prompt with jdk1.4.1. I got all four lines of output.
Sorry for the confusion, thanks for your help.
How do you guys test your code...command prompt? Or do you use java IDEs? (Since many IDE does not let you use the latest jdk...?)
thanks
Unni
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm wondering what this has to do with which IDE you're using?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic