• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Java - Loop through instances of a class

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:Can you give me an example of what you're thinking with the methods stubbed out?



It would just give you entry to the main program,like a main menu or something, Yup Ill do that for ya.
 
Saloon Keeper
Posts: 8588
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kevin O'Sullivan wrote:It would just give you entry to the main program,like a main menu or something, Yup Ill do that for ya.


If it has to call your application's code, then no. And it sounds like you want it to call the main program. On the other hand, the main program could call such a utility first.
 
Carey Brown
Saloon Keeper
Posts: 8588
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would this potentially be portable to another application?
 
Kevin O'Sullivan
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:
If it has to call your application's code, then no. And it sounds like you want it to call the main program. On the other hand, the main program could call such a utility first.



Yes that's actually what I meant, main would call that password class first and then from there you would get into a main menu.
 
Kevin O'Sullivan
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just had a thought, if all the methods in a utility class are suppose to be private, how do you access them from outside the class?
 
Marshal
Posts: 74044
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Who said utility classes had private methods. All the utility classes I can remember seeing have public static methods.
 
Kevin O'Sullivan
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Who said utility classes had private methods. All the utility classes I can remember seeing have public static methods.




Ohhh my mistake I could have sworn I read somewhere they were private.
 
Campbell Ritchie
Marshal
Posts: 74044
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We all make mistakes; it takes bottle to admit to them.
 
Kevin O'Sullivan
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:Can you give me an example of what you're thinking with the methods stubbed out?



Heres the example carey

 
Master Rancher
Posts: 4465
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many of those methods look like they require information to do their job.  static methods should be completely self informed with all the data needed.
The methods that check need  a way to show if the data they received was accepted or rejected: return a boolean or throw an exception
reply
    Bookmark Topic Watch Topic
  • New Topic