4 Replies - 25320 Views - Last Post: 24 March 2009 - 04:28 AM Rate Topic: -----

#1 agprema  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-March 09

How to use if condition in Java

Post icon  Posted 23 March 2009 - 12:21 PM

Hi All,

Can anyone of you guide me that how to use IF condition in Java?

Thanks,
Vani.
Is This A Good Question/Topic? 0
  • +

Replies To: How to use if condition in Java

#2 Fuzzyness  Icon User is offline

  • Comp Sci Student
  • member icon

Reputation: 669
  • View blog
  • Posts: 2,438
  • Joined: 06-March 09

Re: How to use if condition in Java

Posted 23 March 2009 - 12:25 PM

I would love to sit here and tell you all about it, but someone else took the time to educate you already ;)
mostyfriedman Tutorial
Happy Coding!! :)
Was This Post Helpful? 0
  • +
  • -

#3 Nat3TheGreat13  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 162
  • Joined: 09-February 09

Re: How to use if condition in Java

Posted 23 March 2009 - 12:30 PM

You can also check out the Sun tutorials.
http://java.sun.com/...ndbolts/if.html
Was This Post Helpful? 0
  • +
  • -

#4 priya_lorha  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 78
  • Joined: 02-August 08

Re: How to use if condition in Java

Posted 24 March 2009 - 04:05 AM

Example of if

if(condition)
statement;

if(condition)
{statement;}else
{statement 2;}

Demostaration of if
class ifdemo{
public static void main(int n){

if(n%2==0)
System.out.println("The no is even!!");
else
System.out.println("The no is even!!");}}





class maxmin{
public static void main(int a,int b){
if(a>b)
System.out.println("a`s value is minimum b`s value is maximum");
else
System.out.println("b`s value is minimum a`s value is maximum");
}}

Was This Post Helpful? 0
  • +
  • -

#5 spikesanguine  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 16
  • Joined: 10-October 08

Re: How to use if condition in Java

Posted 24 March 2009 - 04:28 AM

View Postpriya_lorha, on 24 Mar, 2009 - 03:05 AM, said:

Example of if

if(condition)
statement;

if(condition)
{statement;}else
{statement 2;}

Demostaration of if
class ifdemo{
public static void main(int n){

if(n%2==0)
System.out.println("The no is even!!");
else
System.out.println("The no is odd!!");}} //CORRECTION





class maxmin{
public static void main(int a,int b){
if(a>b)
System.out.println("a`s value is minimum b`s value is maximum");
else
System.out.println("b`s value is minimum a`s value is maximum");
}}

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1