Skip navigation links

Class Java

Jump to: METHODS CONDITIONS VARIABLES

    • Condition & Loops Summary

      Condition or Loop Description
      if  Only if something (parameter) is true, then execute the code under the loop
    • Condition & Loops Detail

      • if boolean test {method};

        if(boolean test)
        Usage:
        if something (parameter) is true, then execute the code in between the brackets
        Example:
        Code Output
        bool test = true;
        if test {System.out.println("true")};
        true
        bool test = false;
        if test {System.out.println("false")};
        (no output)
    • Variables Summary

      Variable Declaration Description
      Integer  int Only numbers from negative infinity to infinity
      Boolean  bool Value can be either true or false a.k.a yes or no
    • Variables Detail

      • Integer

        Integer
        Declaration:
        Use the keyword int befor declaring an integer variable. Example: int example = 5;
        Example:
        Code Output
        int example = 5;
        System.out.println(example);
        5
      • Boolean

        Boolean
        Declaration:
        Use the keyword bool before declaring the variable. Example: bool test = true;
        Example:
        Code Output
        bool test = true;
        System.out.println(test);
        true