Log in

View Full Version : CLASS 3: if else Statement In Java


Morash
04-10-2014, 01:08 AM
if else Statement In Java

This Is Another Form Of if Statement. It Is Used For Making Two Way Decisions.
In This Statement There Is One Condition And Two Statements.
If The Condition Is True The First Statement Is Executed And Second Statment Is Ignored.
And If The Condition Is False Then The Second Statement Is Executed And
First Statement Is Ignored.



Syntax:

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




Example:

Note: in.nextInt(); Is Used For Input Of Integer Type Value.
Whereas in.nextLine(); Is Used For Input Of String/Char Type Value.

http://i61.tinypic.com/10mlo2o.jpg




Output:

http://i59.tinypic.com/rsfvq0.jpg

pakeeza
04-10-2014, 11:49 AM
Thnksssss For shaarinG M

PRINCE SHAAN
04-10-2014, 12:39 PM
Thanks for nice sharing dear................

Akash
04-10-2014, 01:04 PM
Gud Job Best Of Luck ... Thankx For sharing Kabi to Kam ajega na ..

AYAZ
04-10-2014, 03:56 PM
Thanks morash, done with it ;).

AYAZ
04-10-2014, 04:24 PM
Morash, how we can input character if we want to.

I know, we have to declare char a[42]; but that was in C++.

if you could share a small program in which we can decalre a character and take input that would be really helpful.

Morash
04-12-2014, 01:13 AM
Morash, how we can input character if we want to.

I know, we have to declare char a[42]; but that was in C++.

if you could share a small program in which we can decalre a character and take input that would be really helpful.

Char K Liye Pahle Hum Input String Mai Lengy ..
Phir Os Ko Char Array Mai Change Karengy ..
Next Thread Mai Program Bana K Share Karta Hon ..

Copyright ©2008
Powered by vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.