20CS304 Lecture 1: If Else Statements

4 views4 pages
4 May 2023
Department
Course
Professor

Document Summary

You already know that java supports the usual logical conditions from mathematics: less than: ab, greater than or equal to: a>=b, equal to a==b, not equal to: a!=b. You can use these conditions to perform different actions for different decisions. Java has the following conditional statements: use if to specify a block of code to be executed, Use the if statement to specify a block of java code to be executed if a condition is true. //block of code to be executed if the condition is true. Use the else statement to specify a block of code to be executed if the condition is false. // block of code to be executed if the condition is true. // block of code to be executed if the condition is false. Use the else if statement to specify a new condition if the first condition is false.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions