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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 659

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: 19538
    
  16

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