Hey there! We receieved your request
Stay Tuned as we are going to contact you within 1 Hour
One of our academic counsellors will contact you within 1 working day.
Click to Chat
1800-5470-145
+91 7353221155
Use Coupon: CART20 and get 20% off on all online Study Material
Complete Your Registration (Step 2 of 2 )
Sit and relax as our customer representative will contact you within 1 business day
OTP to be sent to Change
what is method , class, switch , if else nested if,etc.
u may refer book for these definitions written by sumita arora, these are given very well there though i may tell you in short:
1.
if/else: it is used to check if a condition is true or not.
for ex. if i want to check if a number is even or odd... and if odd multiply by 2.
we will do it like this:
int a;
if(a%2==0)
{
//no. is even so we will not do anything
}
else
a*=2; // no. is odd so multiply by 2
2.
if we use one more if inside an if than we call it nested if...
it is used if i have to do the following:
if i want to check if a number is even or odd... and if odd multiply by 2 and if even than check if it greater than 5 and than multiply by 2.
{ if(a>5)
{a*=2;}
3.
switch do the same work as of if-else.. it is used when we have multiple conditions to check,.,,
format:
switch(a)
case 1:
break;
case 2:
case 3:
default:
exit(0);
4.class
it is a collection of dissimilar data types, by default all members are private...it implements the concepts of OOP(object oriented programming).
Get your questions answered by the expert for free
You will get reply from our expert in sometime.
We will notify you when Our expert answers your question. To View your Question
Win Gift vouchers upto Rs 500/-
Register Yourself for a FREE Demo Class by Top IITians & Medical Experts Today !