+ 2

Can you make it with b-- or --b ?

Question : Can you make it with b-- or --b ?

26th Feb 2017, 12:44 PM
Sylv1a
Sylv1a - avatar
9 odpowiedzi
+ 3
class PrePostDemo { public static void main(String[] args) { int i = 3; i++; System.out.println(i); // "3" ++i; System.out.println(i); // "4" System.out.println(++i); // "5" System.out.println(i++); // "5" System.out.println(i); // "5" } }
26th Feb 2017, 12:53 PM
Sani Suryavanshi
Sani Suryavanshi - avatar
+ 2
yes)
26th Feb 2017, 12:48 PM
Sani Suryavanshi
Sani Suryavanshi - avatar
+ 2
So.... can you tell me plz an example
26th Feb 2017, 12:49 PM
Sylv1a
Sylv1a - avatar
+ 2
++b is prefix // value assignment before using the variable b++ is postfix // value assignment after using the variable
26th Feb 2017, 12:56 PM
Sani Suryavanshi
Sani Suryavanshi - avatar
+ 2
thx, I did not understand the first and the last one
26th Feb 2017, 12:58 PM
Sylv1a
Sylv1a - avatar
+ 2
I understand it now, THX
26th Feb 2017, 1:00 PM
Sylv1a
Sylv1a - avatar
+ 2
if you use b++ so the value of b remains the same and print same but only first time and after it will increase by 1 next time when it will print on the other hand ++b so the value will increase by 1 and then print.... simple :)
26th Feb 2017, 1:02 PM
Sani Suryavanshi
Sani Suryavanshi - avatar
0
lets make connection ,, here is my id ( sani_suryavanshi@outlook.com)
26th Feb 2017, 6:57 PM
Sani Suryavanshi
Sani Suryavanshi - avatar
0
низрена не понял что написано
1st Mar 2017, 11:41 AM
Сергей Якушев
Сергей Якушев - avatar