aspose file tools*
The moose likes Beginning Java and the fly likes [newbie] Cannot access StaticInnerClass Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "[newbie] Cannot access StaticInnerClass" Watch "[newbie] Cannot access StaticInnerClass" New topic
Author

[newbie] Cannot access StaticInnerClass

Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 660

I'm following a book example, and somehow the code doesn't seem to access a static method. I didn't really understand how the methods getMin() and getMax() are related to public static Pair minmax(double[] values) method. I don't think I would use such a complicated way of retrieving a maximum or a minimum although it can be useful for organizing a number of values into a single array.





Compilation error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method minmax(double[]) is undefined for the type ArrayAlg

at homnetwork.bkr.training.StaticInnerClassTest.main(StaticInnerClassTest.java:14)


Jon
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
What happens if you change "ArrayAlg.minmax(d);" to "ArrayAlg.Pair.minmax(d);"?


SCJA
~Currently preparing for SCJP6
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19719
    
  20

Brian Legg wrote:What happens if you change "ArrayAlg.minmax(d);" to "ArrayAlg.Pair.minmax(d);"?

Right. Because the static method minmax is not defined in class ArrayAlg, but in class ArrayAlg.Pair.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [newbie] Cannot access StaticInnerClass