Assume choice references a string. The following if statement determines whether choice is equal to ‘Y’ or ‘y’:if choice == 'Y' or choice == 'y':Rewrite this statement so it only makes one comparison and does not use the or operator. (Hint: use either the upper or lower methods.)

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 15RQ
icon
Related questions
icon
Concept explainers
Question

Assume choice references a string. The following if statement determines whether
choice is equal to ‘Y’ or ‘y’:
if choice == 'Y' or choice == 'y':
Rewrite this statement so it only makes one comparison and does not use the or operator. (Hint: use either the upper or lower methods.)

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT