Home
Tutorials
Core Java
Introduction To Java
Java Evolution
Overview of Java
Constants, Variables and Data Types
Java Operators
Branching Statements
Looping Statements
Classes, Objects and Methods
Inheritance
Array, String and Vectors
Java Interfaces
Java Packages
Applet Programming
Graphics Programming
Advanced Java
Java AWT
Java Event Handling
Java File Handling
Java MultiThreading
Java Swing-I
Java Swing-II
Exception Handling
Socket Programming
Java Database
Java RMI
Java Servlets
Java Beans
Programms
Projects
Downloads
Contact
Java Programming
!doctype>
Nested If statement using Java Programming
//Nested if-else... import java.io.*; class NestedIf { public static void main(String args[]) throws Exception { String a,b,c; System.out.print("\n\tEnter the First Number :\t"); BufferedReader ob1=new BufferedReader(new InputStreamReader(System.in)); a = ob1.readLine(); int a1 = Integer.parseInt(a); System.out.print("\n\tEnter the Second Number :\t"); BufferedReader ob2=new BufferedReader(new InputStreamReader(System.in)); b = ob2.readLine(); int b1 = Integer.parseInt(b); System.out.print("\n\tEnter the Third Number :\t"); BufferedReader ob3=new BufferedReader(new InputStreamReader(System.in)); c = ob3.readLine(); int c1 = Integer.parseInt(c); if(a1 > b1) { if(a1 > c1) { System.out.print("\n\tA is Greatest"); } else { System.out.print("\n\tC is Greatest"); } } else { if(b1 > c1) { System.out.print("\n\tB is Greatest"); } else { System.out.print("\n\tC is Greatest"); } } } }
Output of "NestedIf.java"
Read more »
Download Complete Program
-
No comments:
Post a Comment
No comments:
Post a Comment