[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/windweb/JavaTutorial/master/src/F021_IfStatements.java [Back]  [Original]

/* If Statements /   if
if - ,       

if () {
    
}
*/

/* conditions.txt:

If temp is greater than 30
    It's a hot day
    Drink plenty of water
Otherwise, if it's between 20 and 30
    It's a nice day
Otherwise
    It's cold
*/
/* .txt:

   30
      
      
  ,    20  30
      
  
     
*/

public class F021_IfStatements {
    public static void main(String[] args) {
        int temp = 20;
        if (temp > 30) {
            System.out.println("It's a hot day");
            System.out.println("Drink plenty of water");
        }
        else if (temp < 20)
            System.out.println("It's cold");
        else
            System.out.println("It's a nice day");
    }
}


Web Proxy Viewer  |  New URL  |  Original Page