For Prefix increment/decrement the rule is first increase and then use. So when a = 12 , ++a = 13. For more information click on the link below!! ruclips.net/video/yPpclaO3ecY/видео.html I hope it helps you ✨
Depends on the type of our a and b and c. We should see whether our a,b,c are "int" or "double" if integer >> int a= 12; int b=8; int c = ++a/6+b++%3; System.out.println(c); 4 if double >> double a= 12; double b=8; double c = ++a/6+b++%3; System.out.println(c); 4.166666666 so in this case their type is double.
First function, then change.(This is how I used to remember) When you give b++(let's take b=8) The old value or unchanged value of b will be printed first ie-8.(First Function) Then the new value of b ie-9 , will be stored in variable b.(Then change) Now if you print b, it will print 9. This is how postfix works. Hope this helps😊
In post increment , Step 1:-value use Step 2:-value change ex- int b=8; int a=b++; System.out.println(a); output - 8 [ bcz here is post increment firstly value use hogi then value change hogi] In pre increment , Step 1:-value change Step 2:-value use ex- int b=8; int a=++b; System.out.println(a); output- 9 [bcz here is pre increment firstly value change hogi then value use hogi ] Hope this helps😊
How does ++a become 13? Please help me understand this one😭
For Prefix increment/decrement the rule is first increase and then use. So when a = 12 , ++a = 13.
For more information click on the link below!!
ruclips.net/video/yPpclaO3ecY/видео.html
I hope it helps you ✨
because it has an increment, increment increases the initial value by one.
a = 12
++a becomes 13, as it has increment
@@iseul017 hiii
13/6 will be 2 in java
Depends on the type of our a and b and c. We should see whether our a,b,c are "int" or "double"
if integer >>
int a= 12; int b=8;
int c = ++a/6+b++%3;
System.out.println(c);
4
if double >>
double a= 12; double b=8;
double c = ++a/6+b++%3;
System.out.println(c);
4.166666666
so in this case their type is double.
Watch our latest video on short questions on Java Character Class - ruclips.net/video/N7iNHtlLn2Q/видео.html
Yup
If it's an int type
How
b=8 ;
b++;
b++=8
if we Their is increment then how b++=8 instead of b++=9??? pls help me
Bcoz it is post increment.
First function, then change.(This is how I used to remember)
When you give b++(let's take b=8)
The old value or unchanged value of b will be printed first ie-8.(First Function)
Then the new value of b ie-9 , will be stored in variable b.(Then change)
Now if you print b, it will print 9.
This is how postfix works. Hope this helps😊
In post increment ,
Step 1:-value use
Step 2:-value change
ex-
int b=8;
int a=b++;
System.out.println(a);
output - 8
[ bcz here is post increment firstly value use hogi then value change hogi]
In pre increment ,
Step 1:-value change
Step 2:-value use
ex-
int b=8;
int a=++b;
System.out.println(a);
output- 9
[bcz here is pre increment firstly value change hogi then value use hogi ]
Hope this helps😊
the f hahah why ++a and b++ the same application?
your last answer is wrong the value should be c=2, but explanation
its correct
Are u a boy or girl?