Or in Java if statements -


in java, there way ors in if statements? beginner programmer in java , no previous programming experience, bit of noob. know can &&, has true, need 1 true, , want in better way bunch of if statements next each other.

ex: there more simple/compact way this:

        if(num == 1)         {               system.out.println("that number")         }         if(num == 2)         {               system.out.println("that number")         } 

|| logical or.

if(num == 1 || num == 2) 

also need use == equality. in java = assignment.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -