0
What is the problem of this code in java?
public class Project { public static void main(String[] args) { int a = 5; int b = a++; int c = b++; System.out.printIn(c); } }
6 Answers
0
because you are using post increment operator it adds 1 to a after the statement int b = a++; if you want it to work use pre increment operator that's ++a
0
Na I know that but This program isnt print variable of c and alert which non-sense error
0
/*This code too*/
public class Project
{
public static void main(String[] args) {
int c = 6;
System.out.printIn(c);
}
}
/*When I try it's error so I must use "System.out.print"*/
0
output is 5 because of post increment
0
yes use pre increment operator.that is
b=++a;
c=++b;
0
I'm roger I'm roger
But I mean the error is System.out.printIn function
doesnt working T-T