Meaningless Drivel is fun!*
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 Android Security Essentials Live Lessons this week in the Android forum!
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: 19656

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
subject: [newbie] Cannot access StaticInnerClass
Similar Threads
Error when using JDOM
SiMpLe Program but......I still beginner
ava.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
CODE: Dynamic Sorting on Multiple Indexes
Simple J2SE 5.0 Tiger Notes