In many real time applications, I observe the object creation is in the static method. And all the methods in that class will be non static. And all non static methods is used in the other classes like What is the main advantage of doing this. TO my knowledge we can do this another way also. Just make the name() method as static and use that in another class without creation of object.Realtime application code base looks like this
As the constructor is public singelton advantage is also ruled out.
posted 9 years ago
From what I can see, the only difference is, you have two different ways of calling the getname() function
If you want to reference the getname method non-statically, you're going to have to create an instance of that class, where as in the first example you use only static methods, so you don't.
Justin Fox [ February 22, 2008: Message edited by: Justin Fox ]
You down with OOP? Yeah you know me!
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad: