Conditional and Relational Operators/Statements

Descripción

Shows what is necessary to learn, and in what order, for conditional and relational operators/statements
nini798
Mapa Mental por nini798, actualizado hace más de 1 año
nini798
Creado por nini798 hace alrededor de 9 años
18
0

Resumen del Recurso

Conditional and Relational Operators/Statements

Nota:

  • Learn these: < (less than), >(greater than), ==(equal to), <=(less than/equal to), >=(greater than/equal to), !=(does not equal) See more: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html
  1. Conditional Operators

    Nota:

    • Learn These: &&(and), ||(or)
    1. De Morgan's Law

      Nota:

      • De Morgan's Law: !A && !B == !(A || B); !A || !B == !(A && B); Find more info here: http://fcmail.aisd.net/~JABEL/1DeMorgansLaw.htm
    2. Conditional Statements

      Nota:

      • If/then statements switch statements See more: https://www.inf.unibz.it/~calvanese/teaching/04-05-ip/lecture-notes/uni05.pdf
      1. If/Then statements

        Nota:

        • Syntax: if(condition){     statements } see more: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html
        1. Multiple else/if

          Nota:

          • syntax: if(condition){    statements; } else if(condition){    statements; } ... //as many as you need else{ statements; }
          1. nested if statement

            Nota:

            • Nested if statements are if statements within if statements. There also can be else statements within these. Pair up the ifs and else's by having the pair closest line up if they are in the same brackets. Try starting with the inner ifs Then pair the outer ones. Ex: if(condition){ //pairs with last    if(condition){ //pairs with 1st    }    else{ //1st else     } } else{ //last else } see more: https://www.cs.umd.edu/~clin/MoreJava/ControlFlow/nested-if.html
          2. Switch Statements

            Nota:

            • syntax: switch(variable){     case value: statements;                           break; //optional     ... } see more: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html
            1. Valid data types

              Nota:

              • You can use a byte, short, char, int or String(Java 7+ only). You can also use other "wrapper" classes that hold these values, such as Character, Byte, Short, Integer. These will be used later in the year. See more: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html
              1. Case Groups

                Nota:

                • if there is no statements after a case, the next statements after a case will be used instead. This means multiple conditions can be used for the same statement. Example: int test = 2; switch(test){ case 1: case 2: case 3: System.out.println("test < 4"); break; case 4: case 5: System.out.println("test >3"); break; } This shows how multiple values can be used for one statement within a switch. For another example, look toward the bottom of this page: http://www.dummies.com/how-to/content/switch-statements-in-java.html    
                1. Break

                  Nota:

                  • break within a switch statement exits the rest of the switch statement once hit. Without a break in a switch, it will keep running through the cases even if another has already been activated. Here's an example of when it would be useful to include a break: http://stackoverflow.com/questions/2710300/why-do-we-need-break-after-case-statements
                2. Default

                  Nota:

                  • "case default:" is used at the end of a switch and always runs at the end if the switch hasn't broken. It is usually used to let the user know that the variable tested didn't meet any of the case values. See here for explanations and a small exersice: http://www.homeandlearn.co.uk/java/java_switch_statements.html
              Mostrar resumen completo Ocultar resumen completo

              Similar

              Java Week 5 Object Oriented Programming
              Troy Bowlin
              Conditional Operators and Statements
              nini798
              French Tense Endings
              James Hoyle
              Java Practice 1
              Ummm No
              Spanish Tenses
              Joe McElroy
              Java Practice 2
              Ummm No
              Servion - Java Questionnaire
              rohit.benedict
              Java Core. Basics
              Gadget
              Chapter 3 & 4 Review
              Shannon Anderson-Rush
              Programming Review
              Shannon Anderson-Rush
              Useful String Methods
              Shannon Anderson-Rush