public class Main
{
public static void main(String[] args) {
int a;
System.out.println(a+1000);
System.out.println(a + 1000);
}
}
What is the diffrence? between the two plus signs?see gap and no gap, Code gym compiler is showing different colours of plus sign in both cases.
Under discussion
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Ndi
28 October 2018, 22:28
I think the two are technically the same. They should output the same results. The differnce is in presentation
0
Clifford Ten
28 October 2018, 14:15
the System.out.println(a+1000); will print the result obtain from a+1000
while System.out.println(a + 1000); will print a (as the integer it is) and then print 1000,
that is if a=5
this System.out.println(a+1000); will print 1005
while this System.out.println(a + 1000); will print 51000
0
Ndi
28 October 2018, 22:30
Hi Clifford, try that code and see if the results are differentas you suggested. Am not sure
0
Clifford Ten
29 October 2018, 09:08
oh ho yeah that is bcs both are integers and they normally add up together, no matter the way it is represented.
Am sorry for my misinterpretation and thanks for the overview
0