Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

help

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I run the following code:
public class testassign{
public static void main(String [] args){
int x1 = 10 + + 11;

int x2 = 10 + + + 11;

int x3 = 10 + + + + + 11;

System.out.println("x1 = " + x1);
System.out.println("x2 = " + x2);
System.out.println("x3 = " + x3);
}
}
the rusult is:
x1 = 21
x2 = 21
x3 = 21
Could somebody make me clear. Thank you!
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

x1 = 10 + [space] + 11;
is the same as
x1 = 10 + 0 + 11;
or
x1 = 10 + 11;
cheers
SS
http://www.geocities.com/sahirshah/
 
Alas, poor Yorick, he knew this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!