COMP 202 Lecture Notes - Lecture 8: Boolean Expression, While Loop

47 views3 pages
jc123 and 40170 others unlocked
COMP 202 Full Course Notes
100
COMP 202 Full Course Notes
Verified Note
100 documents

Document Summary

Comp202 lecture 8 strings and while loops. String: a sequence of characters eg. hello world . A string is a class, and a specific string is an object. We can"t use the same operators on strings as we use with primitive data types. Instead, there is a set of methods provided to manipulate strings. The documentation for strings can be found here: https://docs. oracle. com/javase/7/docs/api/java/lang/string. html. You can compare strings using the following. Note: equals is case sensitive. Use equalsignorecase if you don"t want to distinguish between upper and lower case. How can this be applied? a = false. = true (as equalsignorecase doesn"t worry about the case of the letter, so course and course2 are the same) A simple calculator program employing . equals: This is the same as int x = 2; x = x+5; x=x+1; This block of code is repeatedly executed, as the long as the condition remains true. Iteration: a single execution of the code inside the while loop.

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