• Post Reply Bookmark Topic Watch Topic
  • New Topic

Two ways to create a class  RSS feed

 
Sure Vat
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which is the best aproach to create a class -Constructor or Static Factory ? check out http://goo.gl/KgpU2
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure Vat wrote:Which is the best aproach to create a class -Constructor or Static Factory ? check out http://goo.gl/KgpU2
\\

As with most questions like this, the answer is, "It depends," and there is no one "best" way
 
Randall Twede
Ranch Hand
Posts: 4696
8
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aha...you can have an abstract class with all methods fully implemented, but you dont want it instantiated(presumably because such a class would make little or no sense). presumably extending classes would provide additional methods.
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, Sure Vat, that you asked a new question, which merits a new thread to itself.
Your link says there are two ways to create an object, but there are several other ways to achieve that in Java™.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!