someval = (min >= 2) ? 2 : 1;
This is called ternary operator, which can be used as if-else
. this is equivalent to
if((min >= 2) { someval =2; } else { someval =1 }
Follow this tutorial for more info and usage.
Related Posts:
- What does “?” mean in Java? [duplicate]
- What is the Java ?: operator called and what does it do?
- What is a Question Mark “?” and Colon “:” Operator Used for?
- What does “?” mean in Java? [duplicate]
- Does Python have a ternary conditional operator?
- What is an instance variable in Java?
- Does Python have a ternary conditional operator?
- super() in Java
- What’s the syntax for mod in java
- What does the Java assert keyword do, and when should it be used?
- How do I make a delay in Java?
- Casting variables in Java
- max value of integer
- How can I prevent java.lang.NumberFormatException: For input string: “N/A”?
- What is the difference between == and equals() in Java?
- Java – No enclosing instance of type Foo is accessible
- Why I am getting java.lang.AbstractMethodError errors?
- fix java.net.SocketTimeoutException: Read timed out
- How to override equals method in Java
- java.text.ParseException: Unparseable date
- How to write an inline IF statement in JavaScript?
- Java – String cannot be converted to int
- java.io.IOException: Broken pipe
- java.util.NoSuchElementException: No line found
- Even though JRE 8 is installed on my MAC -” No Java Runtime present,requesting to install ” gets displayed in terminal
- Reason for the exception java.lang.VerifyError: Bad type on operand stack
- How to check if my string is equal to null?
- The specified DSN contains an architecture mismatch between the Driver and Application. JAVA
- Downcasting in Java
- Java “params” in method signature?
- Short form for Java if statement
- Ternary operator in PowerShell
- How do I time a method’s execution in Java?
- repaint() Method in Java
- ternary operator in matlab
- Exception in thread “main” java.lang.reflect.InvocationTargetException
- How to set String’s font size, style in Java using the Font class?
- How to use the command update-alternatives –config java
- java array error “array required but int found”
- this: Cannot use this in static context
- What’s the difference between SoftReference and WeakReference in Java?
- How to draw lines in Java
- NoClassDefFoundError in Java: com/google/common/base/Function
- In Java, what is a shallow copy?
- Good way to encapsulate Integer.parseInt()
- Eclipse IDE – Error: Build path specifies execution environment Java SE 1.7
- Java: Not a statement
- ArrayList of int array in java
- How to get the filename without the extension in Java?
- How can I upgrade to Java 1.8 on an Amazon Linux Server?
- How can I solve “java.lang.NoClassDefFoundError”?
- “Char cannot be dereferenced” error
- Explanation on Integer.MAX_VALUE and Integer.MIN_VALUE to find min and max value in an array
- javax vs java package
- ‘git’ is not recognized as an internal or external command
- Converting array to list in Java
- SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”
- “Missing return statement” within if / for / while
- How to convert byte array to string and vice versa?
- good example of Javadoc
- Error when checking Java version: could not find java.dll
- Java Round up Any Number
- How to write trycatch in R
- Copying and modifying array elements
- How to convert List
to int[] in Java? - How to send Https Post request in java
- Java error: Implicit super constructor is undefined for default constructor
- What is the purpose of a listener in Java?
- Is there a destructor for Java?
- What condition does while(true) test? When is it true and false?
- git add . -> still “nothing to commit” with new files
- git submodule add error: does not have a commit checked out
- ResultSet exception – before start of result set
- The activity must be exported or contain an intent-filter
- How to set JAVA_HOME environment variable on Mac OS X 10.9?
- Android – Package Name convention
- Remove last character of a StringBuilder?
- How to transparent Unity3D custom shader?
- The specified child already has a parent. You must call removeView() on the child’s parent first (Android)
- HTTP Status 500 Error instantiating servlet class
- How to convert the following json string to java object?
- Differentiate between function overloading and function overriding
- Address already in use: JVM_Bind java
- java.lang.ClassNotFoundException:com.mysql.jdbc.Driver [duplicate]
- How can I check if a value is of type Integer?
- Using regex to match any character except =
- Why is a ConcurrentModificationException thrown and how to debug it
- Adding JPanel to JFrame
- Append a single character to a string or char array in java?
- Java printf formatting to print items in a table or columns
- How to resolve “Syntax error on token “else”” in Java?
- What’s the difference between Jetty and Netty?
- What is the proof of of (N–1) + (N–2) + (N–3) + … + 1= N*(N–1)/2
- Java Returning method which returns arraylist?
- String cannot be resolved to a type – Java RAD
- IntelliJ IDEA “The selected directory is not a valid home for JDK”
- Simple timeout in java
- Eclipse message saying List cannot be resolved to a type
- How to login into wordpress.com using HtmlUnit?
- Merge posts plugin? [closed]