About 5,210,000 results
Open links in new tab
  1. java return in the if statement - Stack Overflow

    Use a finally block or save the return value in a variable that you return at the end of your code.

  2. 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 …

  3. Java If ... Else - W3Schools

    Java has the following conditional statements: Use if to specify a block of code to be executed, if a specified condition is true; Use else to specify a block of code to be executed, if the same …

  4. Understanding the Java return Statement with if-else and

    Oct 4, 2024 · In this article, we'll explore how the return statement behaves in these scenarios and how you can effectively leverage it in your code. In Java, the return statement is used to exit …

  5. java - if and else or if and return? - Software Engineering Stack …

    Jan 10, 2020 · It depends on the semantics of your code, if the else branch is the point of the method, i.e. it's named after what happens in the else branch, the early return is probably …

  6. java - A Return inside and outside an If Statement - Stack Overflow

    Aug 16, 2013 · If there is a return statement inside an if statement, inside a method (in the Java language), but I add another at the end as a catch-all and to avoid the error, are both return …

  7. Java if statements - Jenkov.com

    Apr 13, 2024 · The Java if statement enables your Java programs to make decisions about what code to execute depending on the state of variables, or values returned from methods. Here is …

  8. Decision Making in Java (if, if-else, switch, break, continue, jump)

    Apr 16, 2025 · It is used to decide whether a certain statement or block of statements will be executed or not i.e. if a certain condition is true then a block of statements is executed …

  9. How to Use Return Statements vs If-Else in Java?

    In Java, developers often face the choice between using explicit return statements and if-else constructs to handle conditional logic. This decision can significantly impact both readability …

  10. The if-then and if-then-else Statements (The Java™ Tutorials - Oracle

    The if-then statement is the most basic of all the control flow statements. It tells your program to execute a certain section of code only if a particular test evaluates to true. For example, the …

  11. Some results have been removed
Refresh