int s=1;
for (int j = 3; j >= 0; j--)
{
s = s + j;
}
System.out.println(s);7
if (amHappy)
could also be written as:
if (amHappy == true)
if (!amHappy)
could also be written as:
if (amHappy == false) //or if (amHappy != true)
In Java, how do you test to see if string myName equals Joey?
if ( myName.equals(“Joey”) )
//or
if ( myName.equalsIgnoreCase(“joey”) )
//if you want to ignore case
If ( (amHappy) && (tonight) )
could be written as:
if (amHappy==true && tonight==true)
If ( (amHappy) | | (tonight) )
could be written as:
if (amHappy==true || tonight==true)
What is the boolean operator for “and?”
&&
What is the boolean operator for “or?”
||
What is the boolean operator for “equal to?”
==