Operator Precedence

10 0 0
                                    

class MathOperators{

         private String[] operator = {"postfix", "unary", "arithmetic", "Shift", "relational", "bitwise", "logical", "ternary", "assignment"};

         private String myMnemonic;


          MathOperators(String title){

                  myMnemonic = title;

          }

         public void postfixAndPrefixOperators(){

                    System.out.println(operator[0] + " operators");

                    System.out.println("I am the top of the chain. Below is from left to right");

                    System.out.println("x++ \t" + "x-- \t" + "++x \t" + "--x");

           }

           public void unaryOperators(){

                    System.out.println(operator[1] + " operators");

                    System.out.println("I am next to the top. Below is from left to right");

                    System.out.println("+x \t" + "-x \t" + "~ \t" + "! \t");

           }

           public void arithmeticOperators(){

                    System.out.println(operator[2] + " operators");

                    System.out.println("I am third to the top. Below is from left to right");

                    System.out.println("* \t" + "/ \t" + "% \t" + "+ \t" + "- \t");

           }

            public void shiftOperators(){

                     System.out.println(operator[3] + " operators");

                     System.out.println("I am the fourth. Below is from left to right");

                     System.out.println("<< \t" + ">> \t" + ">>> \t");

            }

           public void relationalOperators(){ System.out.println(operator[4] + " operators");

                    System.out.println("I am the fifth. Below is from left to right");

                   System.out.println("< \t" + "> \t" + "<= \t" + ">= \t" + "instanceof \t" + "== \t" + "!= \t");

           }

           public void bitwiseOperators(){

                    System.out.println(operator[5] + " operators");

                    System.out.println("I am the sixth man. Below is from left to right");

                   System.out.println("& \t" + "^ \t" + "| \t");

            }

            public void logicalOperators(){

                   System.out.println(operator[6] + " operators");

Java codes i learned onlineWhere stories live. Discover now