What is similar to C/C++ INT_MAX macros in Java… here is a solution to the problem.
What is similar to C/C++ INT_MAX macros in Java
Like C/C++, there are INT_MAX
macros (#include<limits.h>)
that set the variable to INFINITY.
I WOULD LIKE TO KNOW IF THERE ARE SIMILAR FUNCTIONS/MACROS IN JAVA. I WANT TO SET AN INTEGER VARIABLE TO INFINITY.
Thanks in advance!!
Solution
The static
MAX_VALUE variable of the Integer class is what you want.
Integer.MAX_VALUE
However, this is not so useful in Java because int values in Java are 32-bit anyway.
Go to the
following webpage to learn more about the Integer class:
https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html