aspose file tools*
The moose likes Beginning Java and the fly likes Object Arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Object Arrays" Watch "Object Arrays" New topic
Author

Object Arrays

Joel Christophel
Ranch Hand

Joined: Apr 20, 2011
Posts: 241
    
    1





The printout is:
0
0

Why is this? Didn't I just set both radii to 50? It acts like it's ignoring the method calls from class Circle.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4490
    
    8

Have a closer look at your Circle.setRadius method. It isn't doing what you think it's doing.
Joel Christophel
Ranch Hand

Joined: Apr 20, 2011
Posts: 241
    
    1

Thanks once again
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

Matthew Brown wrote:Have a closer look at your Circle.setRadius method. It isn't doing what you think it's doing.


Classic... I once spent 3 days trying to find one of those errors. ;)
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Ove Lindström wrote:Classic... I once spent 3 days trying to find one of those errors. ;)

Yes... given that compiler also don't warn on such situations.
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

John Jai wrote:
Ove Lindström wrote:Classic... I once spent 3 days trying to find one of those errors. ;)

Yes... given that compiler also don't warn on such situations.


Exactly. But both PMD and FindBugs detects it so they are used in most of my continuous integration environments nowadays.
ali Dada
Greenhorn

Joined: Oct 03, 2011
Posts: 4
you are declaring:

but you are assigning in setRadius as


By default the variable which is integer is 0; so it displays 0;
write as:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Object Arrays