Search code examples
javaconditional-statementsboolean

is there an equivalent if statement in java as this python one?


I usually code python, but decided to try to learn a new language (Java). I am a complete beginner with around 2 hours of experience. In python, we can use "or" so that if one condition is satisfied it executes the block of code.EG:

if x>y or 10<12:
  print("one of these is true")

is there an equivalent for this in java ?


Solution

  • I guess

    if( x > y || 10 < 12) { 
    System.out.println("one of these is true"); 
    }
    

    should do the thing.