[Java] It seems that `0 <hoge <10` cannot be written in the conditional expression of the ʻif` statement.

You can use 0 <hoge && hoge <10 ... This article deals with java in mind, I don't know anything else

What is it? What are you saying?

It's hard to explain, Certain condition: When you want to specify a number x that exceeds __0 and is less than 10 __ ~~ There is, right? I sympathize with you! ~~

If you write 0 <x <10 mathematically, you can convey what you want to say, right? However, if you write this in java as it is, it will be erratic.

Example ↓

Conclusion

Even if it is troublesome, let's write 0 <score && score <60, ** variable twice **

Finally

if (0 < x , x < 10) {
  
}

But it's no good, so give up and write &&

Recommended Posts

[Java] It seems that `0 <hoge <10` cannot be written in the conditional expression of the ʻif` statement.
It seems that data class-like functions will be added in Java14
Check with Java / Kotlin that files cannot be written in UAC on Windows
Conditional branching of the result of SQL statement to search only one in Java
[Java] When putting a character string in the case of a switch statement, it is necessary to make it a constant expression
I want to simplify the conditional if-else statement in Java
Summary of ORM "uroboroSQL" that can be used in enterprise Java
Note that system properties including JAXBContext cannot be used in Java11
This and that of the implementation of date judgment within the period in Java
Sample program that returns the hash value of a file in Java
The story that the Servlet could not be loaded in the Java Web application
[Java] Variables declared inside the `for statement` cannot be used outside the` for statement block`
Get the result of POST in Java
[Ruby] if statement concept of conditional expression
The story of writing Java in Emacs
I received the data of the journey (diary application) in Java and visualized it # 001
Summarize the life cycle of Java objects to be aware of in Android development
[Java] Where is the implementation class of annotation that exists in Bean Validation?
[Java] Is it unnecessary to check "identity" in the implementation of the equals () method?
I didn't know that inner classes could be defined in the [Java] interface
Provisional memo when the name of the method parameter of the Java class cannot be obtained by reflection in the Eclipse plug-in project.
The story of low-level string comparison in Java
[Java] Handling of JavaBeans in the method chain
[Ruby] Behavior of evaluation of conditional expression in while
The story of making ordinary Othello in Java
About the idea of anonymous classes in Java
CORBA seems to be removed in Java SE 11. .. ..
The story of learning Java in the first programming
[Java] Scenes that cannot be reassigned (substantially final)
[Java] Be careful of the key type of Map
Feel the passage of time even in Java
There seems to be no else-if in java
Import files of the same hierarchy in Java
Pass the condition to be used in the Java8 lambda expression filter () as a parameter
The story that the variable initialization method called in the Java constructor should not be overridden