Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

1. ## simple java calculation

Hello guys,

I am currently learning Java. Excuse me for my stupid question. I have come across an example in my book which I don't quite understand. Can anyone explain me please?

K has the value 10 and j == 5
It says that the following expression should equal: k==0; j==4;. The expression is:

k/= 25 * j--

I think though that k==10 and j==4 because - we do the following:

k/= 25 * (j=j-1)

k/= 25 * 4

k/= 100

k= k/100

k= 10

As a result k==10 and j==4. Can anyone clarify please?

Thank you

2. ## Re: simple java calculation

I assume k and j are ints.

What is the result of any int divided by a larger int?

3. ## Re: simple java calculation

int / int = int

100:10 = 10 and not 0. This is the way I get it. Could you please clarify what do you exactly mean?

4. ## Re: simple java calculation

An int divided by a larger int, as in:

int k = 10 / 100;

What will k be?

5. ## Re: simple java calculation

ohhh..right..now I got it. How stupid..it will be 0. It will be 10: 100 and not 100:10.