This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "[newbie] Cannot access StaticInnerClass" Watch "[newbie] Cannot access StaticInnerClass" New topic

[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


Brian Legg
Ranch Hand

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

~Currently preparing for SCJP6
Rob Spoor

Joined: Oct 27, 2005
Posts: 19697

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.

How To Ask Questions How To Answer Questions
GeeCON Prague 2014
subject: [newbie] Cannot access StaticInnerClass