MeraForum Community.No 1 Pakistani Forum Community

MeraForum Community.No 1 Pakistani Forum Community (http://www.MeraForum.Com/index.php)
-   Java (http://www.MeraForum.Com/forumdisplay.php?f=217)
-   -   CLASS 3: if else Statement In Java (http://www.MeraForum.Com/showthread.php?t=113237)

Morash 04-10-2014 01:08 AM

CLASS 3: if else Statement In Java
 



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

Re: CLASS 3: if else Statement In Java
 
Thnksssss For shaarinG M

PRINCE SHAAN 04-10-2014 12:39 PM

Re: CLASS 3: if else Statement In Java
 
Thanks for nice sharing dear................

Akash 04-10-2014 01:04 PM

Re: CLASS 3: if else Statement In Java
 
Gud Job Best Of Luck ... Thankx For sharing Kabi to Kam ajega na ..

AYAZ 04-10-2014 03:56 PM

Re: CLASS 3: if else Statement In Java
 
Thanks morash, done with it ;).

AYAZ 04-10-2014 04:24 PM

Re: CLASS 3: if else Statement In Java
 
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

Re: CLASS 3: if else Statement In Java
 
Quote:

Originally Posted by AYAZ (Post 1932732)
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 ..


All times are GMT +5. The time now is 06:37 PM.

Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.