The Artima Developer Community
Sponsored Link

Java Answers Forum
is this AND valid?

3 replies on 1 page. Most recent reply: Mar 22, 2002 8:18 AM by William

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
GunNam

Posts: 6
Nickname: gunnam
Registered: Mar, 2002

is this AND valid? Posted: Mar 22, 2002 4:33 AM
Reply to this message Reply
Advertisement
if (RegisterLine1 == RegisterLine2 & RegisterLine2 == RegisterLine3 & RegisterLine3 == RegisterLine1)

Is Java limited to only 2? or can I use 3 or more?


Kishori Sharan

Posts: 211
Nickname: kishori
Registered: Feb, 2002

Re: is this AND valid? Posted: Mar 22, 2002 6:19 AM
Reply to this message Reply
> if (RegisterLine1 == RegisterLine2 & RegisterLine2 ==
> RegisterLine3 & RegisterLine3 == RegisterLine1)
>
> Is Java limited to only 2? or can I use 3 or more?

There is no limit such as 2 to 3. You can have as many boolean expressions connected with & as you want.

Lynn Hollerman

Posts: 67
Nickname: gmholler
Registered: Mar, 2002

Re: is this AND valid? Posted: Mar 22, 2002 7:41 AM
Reply to this message Reply
...I've never heard of that limit, either, but isn't it supposed to be "&&" in that kind of a statement?

HTH!
Lynn.

William

Posts: 2
Nickname: jyl
Registered: Mar, 2002

Re: is this AND valid? Posted: Mar 22, 2002 8:18 AM
Reply to this message Reply
hi, gunnam

& is used in a bitwise operation. you should use double & (&&) for AND in comparison. no restriction on how many AND you use.

Flat View: This topic has 3 replies on 1 page
Topic: if statements Previous Topic   Next Topic Topic: System time in nanoseconds

Sponsored Links



Google
  Web Artima.com   

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