ifelsedemo
ifelsedemo
/** * */ /** * @author arun * */ public class ifelse { public static void main(String args[]) { double value = 2; if (value != 0) { if (value > 0) System.out.println("The result = " + (1 / value)); else System.out.println("Sorry, we need a positive number."); System.out.println("-------------------------"); { if (2 > 1) if (3 < 2) { System.out.println("a"); } else if (4 < 3) { System.out.println("b"); } else { System.out.println("c"); } else System.out.println("d"); } } } } /* output * The result = 0.5 ------------------------- c */
Please send comments to
vgdarur.javafive@blogger.com
Copyright © 2008 - iForeRunner.com
http://www.iforerunner.com/