Can we create object for satic class?
if yes plz show with some code based example?
Printable View
Can we create object for satic class?
if yes plz show with some code based example?
yes you can create an object of a static class. But there is no meaning. Because we used an static class when we dont want to create an object. You can used these data members and methods without create
an object. Otherwise u directly create an object without used the static class..Can you clear now????
--------------------
suresh
Generally we can have static inner classes only.
Yes we can create object for static classes. But not necessary.
Ex:
class Sample
{
public static void main(String args[])
{
Math m=new Math();
System.out.println(m.sqrt(120));//with help of object
System.out.println(Math.sqrt(120));//with out object
}