• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

inner class (Sortnames)

 
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, Peter. My mistake.
 
Peter Gragert
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No problem, Marilyn! So I will go on with the next assigment!
 
Paper beats rock. Scissors beats tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic