aspose file tools*
The moose likes Cattle Drive and the fly likes inner class (Sortnames) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "inner class (Sortnames)" Watch "inner class (Sortnames)" New topic
Author

inner class (Sortnames)

Peter Gragert
Ranch Hand

Joined: Jan 16, 2001
Posts: 424
I got the following nitpick (names are changed to not give away...) ;-)
snip------- means: cut out, not important.


snip--------
>public static main( String[] args )
snip-------
>ThisClass com = new ThisClass()
If you need to instantiate an inner class from within a static method, it seems that the best approach is to make the inner c
lass static.
>{
> public String getSecond( Object o)
> {
snip-------
>}
snip-------


I do not understand the remark fully: I nowhere declared
class ... ThisClass. So why it is an inner class?
It is inner implicit?
Where to put static?
On other times the compiler complains that a method used
in main has to be declared static. But the program was compiled without error (or warning) and runs perfectly.
Because I do not understand fully, I put static at all possible places, but each got an error message safe if the declaration is taken out of main.
There I need static because then it is used in static main.
I got the feeling, that nitpicking should have suggested
Take this definition out of main!??? But why should a
local variable to main become a property of the class if
learning to use ArrayList is the purpose?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Sorry, Peter. My mistake.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Peter Gragert
Ranch Hand

Joined: Jan 16, 2001
Posts: 424
No problem, Marilyn! So I will go on with the next assigment!
 
 
subject: inner class (Sortnames)