March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Nested IFNested IF “Boolean” Logical Operations“Boolean” Logical Operations Comparing String ObjectsComparing String Objects
March /18R. Smith - University of St Thomas - Minnesota More IF Features Nested IFNested IF –Use curly braces to control the flow –Example: Loan money if 2 years on job and $25k salary “Boolean” Logical Operations“Boolean” Logical Operations –Boolean variables –! And && and || –Loan example revisited Order of Precedence p. 138Order of Precedence p. 138
March /18R. Smith - University of St Thomas - Minnesota Comparing String Objects The boat analogyThe boat analogy –Illustrating the ‘wrongness’ The view in RAMThe view in RAM –Demonstrating the reality Comparison operatorsComparison operators –String st1, st2; –if (st1.equals(“st2”)) … real match –if (st1.compareTo(“st2”) == 0) … real match compareTo returns <0 if st1 < st2compareTo returns <0 if st1 < st2 compareTo returns >0 if st1 > st2compareTo returns >0 if st1 > st2 An Experiment - getInputDialog stringsAn Experiment - getInputDialog strings
March /18R. Smith - University of St Thomas - Minnesota Creative Commons License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.