Win a copy of Rust Web Development this week in the Other Languages forum!

Max Campa

Greenhorn
+ Follow
since Oct 31, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Max Campa

Hi everyone,

I have a simple question about Anonymous inner classes. Given the following:



Does line 18 create a reference variable that refer to an instance of an anonymous subclass of Foo? Or it creates an instance of Foo?

Thanks

Max
Ok so the rules are 0 to 4 rounds down and 5 to 9 rounds up for example:


This would result to 987.12346.

If I use a float primitive type:

This would result to 987.12347.

Why do we get 7 instead of 6. Where do I find these rules in the Java documentation?

Thanks
Hi Rob,

I just posted the code to understand the rules of rounding double primitive types.

You would probably use BigDecimal.

Thanks Zandis,

where is this rule stated? Does this rule applies to float types too?

So if the double had been 987.123459 the output would be 987.12349.
If the double had been 987.123451 the output would be 987.12345.

I found this document on the Wikipedia about rounding floating point but I dont understand it http://en.wikipedia.org/wiki/Rounding#Types_of_roundings.

Thanks,

Max
Why is the format(double d) method returning "987.12346" with the digit 6 instead of 5?

Thanks,

Max
Hi there,

I stepped trough the following code:


When reaching line 13 the format(double d) method returns the String "987.12346" instead of "987.12345"?

Regards,

Max
Thank you George. I have debugged the code and now it makes sense.
Hi there,

can anyone explain to me the following:

Given:


When line 20 is reached, how many objects will be eligble for garbage collection?

The correct answer is 1 and the explanation is:

It should be clear that there is still a reference to the object referred to by a2 ( I understand that), and that there is still a reference to the object referred to by a2.b2 ( I understand that).

What might be less clear is that you can still access the other Beta object trough the static variable a2.b1 becausae it s static ( I dont understand this).

Which object is elegible for GC?

Regards

Max