By default a class is singleton or not ..
public class You{
}
public class My(){
public static void main(String a[]){
You you=new You();
}
}
is you
object is singleton ..
if it is singleton how to make it prototype ..
if it is prototype how to make a class as singleton..
Thank you in advance..
No, it's not a singleton. You can create multiple instances:
You you1 = new You();
You you2 = new You();
A singleton class enforces only a single instance being created, usually by including a private constructor, and a static method to retrieve the single instance. This can be achieved simply in Java using an enum with only one value.
Then:
if it is singleton how to make it prototype
The term "prototype" has no meaning in Java. EDIT: If you're talking about Spring, prototype is a scope - and it's very Spring-specific.
See more on this question at Stackoverflow