Title | COP 3330 Boolean Expression Review IN JAVA |
---|---|
Author | Keithnulds hh |
Course | Object Oriented Programming |
Institution | University of Central Florida |
Pages | 2 |
File Size | 32.7 KB |
File Type | |
Total Downloads | 19 |
Total Views | 162 |
Download COP 3330 Boolean Expression Review IN JAVA PDF
Object Oriented Programming: 8/31/2018
Sequential Execution: - Means that statements are executed in the order that they need to be ran in Boolean Expression: - Expression that can evaluate to true or false - a > b where they are both numeric types - quacks && hasFeathers where both are boolean variables - myList.isEmpty() where myList is a Java list instance
Invalid Types: - x + y, where x and y are numeric data types - p1.compute(), where p1 is an object and compute() method returns a number
IF Statement: - Determines whether or not a block of code is executed
Statements
if ( < boolean_expression>) { //block of statements (the "if block") }
//More statements
If else:
if( ) { //if-block
}else{ //else-block }
Example:
if ( x > 5 ) { if ( y > 5 ) { System.out.println("both x and y > 5"); } else System.out.println ("x...