what is this means int a+=1 in java

Recommended Answers

All 2 Replies

It means int a = a + 1;

Member Avatar for 111100/11000

that should mean:

int a = a + 1;

but it should be also an error if you try to add 1 to uninitialized a if a is local variable of a method
however if a is a class variable than it is initialized by default to 0 so this code would make it 1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.