• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object Creation of Java Class

 
leela krishhna
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Requirement:

class A
{
void m1()
{
System.out.println("Hello JAVA");
}
}

For the above class A, we need to create 5 Obects only,
If we try create 6th object it will returns the same reference of previous..
(Means we need to create only 5 Objects)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What thoughts do you have on how to accomplish this?

Hint: Factory

I assume that this is an assignment or interview question? It'd be a silly thing to do in real code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic