Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Factory

 
William Pearson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Each Roo should have a Moo and a Loo. Each Moo and Loo have names but how would I refer to to names of the parts of the Roo in the ROO_LIST?
 
Matt Cartwright
Ranch Hand
Posts: 152
Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alrighty, let's assume

Roo {

actually means

class Roo {

what does getInstance() return? An instance of Roo?

Where does the string returned by getStrin() on the instance
returned by getInstance() get set?

And what type is Object? A singleton?
I have been using getInstance() on singletons only.

Matt
 
Henry Wong
author
Marshal
Pie
Posts: 21408
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Agreed. This question seems to be about pseudo code than Java -- and even then, the question seems to be unclear.

Henry
 
William Pearson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, getInstance() returns the Singleton.
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No offence but I think that you should try to use less patterns and first learn java. And give us some more information because we're guessing. What is Object? Is it the java.lang.Object class? Then it's no wonder that it's not compiling because that class does not contain the static function getInstance.
 
William Pearson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not java.lang.Object.
 
Maneesh Godbole
Saloon Keeper
Posts: 11092
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William,
It is always a good idea to PostRealCode
 
Matt Cartwright
Ranch Hand
Posts: 152
Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Pearson wrote:It is not java.lang.Object.


If you ask others to answer your questions,
you should be s polite to answer theirs.

There was no doubt about that Object not being java.lang.Object.

So, what type is it?

And could you provide some code that actually
stands a chance to compile? Please.

Would help us to help you.

Matt
 
William Pearson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found the answer to my question. I appreciate the help. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic