Powered by Blogger.

Java - If-else Statement & Using Program in Java

if-else Syntax:

if(<boole an expression>)
<statement_or_block>
else
<statement_or_block>


Example of if-else:-

 public class IfTest{
  public static void main(String[]args){
  int x = (in) (Math.random()*100);
  System.out.prinln(x);
  if(x>100){
  System.out.println(”WHITE”);
  }
  else{
  System.out.println(”BLACK”);
    }

  }
 }

1 comment:

  1. Pretty good post. I just came across your site and wanted to say that I’ve really enjoyed reading your posts. In any case I’ll be subscribing to your feed and I hope you will keep a good work!Cheer!

    sap online training
    software online training
    sap sd online training
    hadoop online training
    sap-crm-online-training

    ReplyDelete