About 463,000 results
Open links in new tab
  1. Comparing multiple integers in IF statement, Java

    Jan 19, 2015 · The only way to compare multiple if statements is to use: if(integer > 1 && integer > 2 && integer > 3) //etc Otherwise you can have: if(integer>1) if(integer>2) //etc You cannot …

  2. java - If statement, compare one variable to multiple - Stack Overflow

    You use || to do boolean OR comparison. The single bar, | is used for bit operations. You can't do this with if statement in Java, but with the switch statement. case 1: case 2: case 3: { //do …

  3. How to Compare String With the Java if Statement | Delft Stack

    Feb 12, 2024 · In this guide, we’ll explore various methods and operators within the context of using the if statements for string comparison in Java. Compare String With the Java if …

  4. Comparing One String With Multiple Values in One Expression in Java

    Mar 7, 2025 · java.util.Set has the contains() method which checks if an element exists in the collection. Hence, we’ll use java.util.Set for our use case with a single expression: boolean …

  5. Compare two Strings in Java - GeeksforGeeks

    Jan 4, 2025 · In this article, we will learn multiple ways to compare two strings in Java with simple examples. Example: To compare two strings in Java, the most common method is equals (). …

  6. Compare integers - Java Code Geeks

    Nov 11, 2012 · In short, to compare two integers i1 and i2 you should: Check if i1 is greater than i2 in an if statement. If it is true, that means that i1 is greater than i2. Check if i1 is less than i2 …

  7. Java If ... Else - W3Schools

    Use the if statement to specify a block of Java code to be executed if a condition is true. Syntax if ( condition ) { // block of code to be executed if the condition is true }

  8. Java if statement - GeeksforGeeks

    Nov 22, 2024 · The Java if statement is the most simple decision-making statement. It is used to decide whether a certain statement or block of statements will be executed or not i.e. if a …

  9. Java program to compare two numbers using if else

    Jul 31, 2024 · In this tutorial, we are going to write a Java program to compare two numbers using if else in Java Programming with practical program code and step-by-step full complete …

  10. java - How to compare Strings in if-else statements? - Stack Overflow

    Oct 7, 2011 · It's a primitive, so you should be able to use == /!= the usual way. You can if necessary convert a String to an int using Integer#parseInt (). Or, even more, if it actually …

Refresh