Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

OR and AND without parenthesis

Thread view: 
IveCal - 22 Jun 2007 03:39 GMT
Hello, I have a question.
assuming, all letters below are either true or false.
Are the following the same:
1. (A OR B) && (C) && (D OR E OR F OR G OR H)
2. A OR B  && C && D OR E OR F OR G OR H
John W. Kennedy - 22 Jun 2007 04:10 GMT
> Hello, I have a question.
> assuming, all letters below are either true or false.
> Are the following the same:
> 1. (A OR B) && (C) && (D OR E OR F OR G OR H)
> 2. A OR B  && C && D OR E OR F OR G OR H

There is no OR in Java. Assuming that you mean ||, no, they are not the same,
just as:

 (a + b) * (c) * (d + e + f + g + h)

is not the same as:

 a + b * c * d + e + f + g + h

Signature

John W. Kennedy
"Only an idiot fights a war on two fronts.  Only the heir to the throne of the
kingdom of idiots would fight a war on twelve fronts"
 -- J. Michael Straczynski.  "Babylon 5", "Ceremonies of Light and Dark"

stefanomnn - 22 Jun 2007 09:07 GMT
> There is no OR in Java. Assuming that you mean ||, no, they are not the same,
> just as:
[quoted text clipped - 10 lines]
> kingdom of idiots would fight a war on twelve fronts"
>   -- J. Michael Straczynski.  "Babylon 5", "Ceremonies of Light and Dark"

wonderful answare!
George N. Morcos - 22 Jun 2007 04:57 GMT
hi

the equation are not the same , they will generate different outputs
the execution sequence will be () --> and --> or

think of it as a numerical equation

> Hello, I have a question.
> assuming, all letters below are either true or false.
> Are the following the same:
> 1. (A OR B) && (C) && (D OR E OR F OR G OR H)
> 2. A OR B  && C && D OR E OR F OR G OR H
Roedy Green - 22 Jun 2007 07:02 GMT
>Hello, I have a question.
>assuming, all letters below are either true or false.
>Are the following the same:
>1. (A OR B) && (C) && (D OR E OR F OR G OR H)
>2. A OR B  && C && D OR E OR F OR G OR H

There are three things you need to understand to solve problems of
this class:

1. the difference between the two flavours of or  | and ||. see
http://mindprod.com/jgloss/boolean.html

2. the difference between the two flavours of or  & and &&

3. the precedence table.  See
http://mindprod.com/jgloss/precedence.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.