Logical operators, JAVA Programming

Assignment Help:

Logical Operators

Operator

Functionality

Example/ Explanation

 

 

&&

Looks at 2 expressions & returns a value of "true" if the expressions on the left & right of the operator are both true

If day = 'friday' && date=13 then alert("do You believe in astrology?") Compares the value of the day and the date. If it is true that today is

a Friday and if it is also true that the date is the 13th, then an alert box pops up with the message "Are You believe in astrology?"

 

 

 

 

 

||

Looks at two expressions & returns a value of "true" if either one -- although not both -- of the expressions are true.

if day='friday'&&date=13  then alert("do you believe in astrology?") else if day='friday'||date=13  then alert("Aren't you glad it isn't Friday the 13th?") Compares the value of the day & the value of the date. If it is true that today is a Friday & if it is also true that the date

is the 13th, then an alert box pops up with

the message " do You believe in astrology?" If both are not true, the script moves onto the next line of code...  Which compares the value of the day & the value of the date? If either one -- however not both -- is true, then an alert box pops up with the message "Aren't you glad it isn't Friday the 13th?"


Related Discussions:- Logical operators

What restrictions are placed on method overriding, What restrictions are pl...

What restrictions are placed on method overriding? Overridden methods must have the similar name, argument list, and return type. The overriding method may not limit the access

Differentiation between if statement and a switch statement, Differentiatio...

Differentiation between if statement and a switch statement ?

EJB in J2EE? , EJB 2.x is broadly adopted server side component architectu...

EJB 2.x is broadly adopted server side component architecture for J2EE. 1. EJB is a remote, distributed multi-tier system and allows protocols like IIOP, JRMP, and HTTP etc.

How many jsp scripting elements , How many JSP scripting elements and what ...

How many JSP scripting elements and what are they? Ans) Three scripting language elements are there: a)      declarations, b)      scriptlets, c)       expressions.

What is javaserver faces ui component , A user interface control th...

A user interface control that outputs data to a client or permits a user to input data to a JavaServer Faces application.

Bookshelves, Ask question #MBookshelves A library decides buy bookshelves t...

Ask question #MBookshelves A library decides buy bookshelves to store its books and they need to determine the bookshelves’ heights and widths in order to minimize storage costs. T

What is static in java, What is static in java? Static means one per cl...

What is static in java? Static means one per class, not one for each object no matter how many example of a class might exist. This means that you can use them without making a

Are constructors inherited, Are constructors inherited ? Can a subclass ca...

Are constructors inherited ? Can a subclass call the parent class constructor and When?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd