I am new to Java, could anyone please help explain this epression to me? Particularly the " ? h : 0)" portion of it.
( ( h >= 0 && h < 24 ) ? h : 0)
it's a if/then expression.
( h >= 0 && h < 24 ) is the condition,
the result of the expression is the value of h if the condition is true,
the result of the expression is 0 otherwise.
See the JLS:
Thanks for your help. I get it now.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.