-
Junior Member
Object for static class
Can we create object for satic class?
if yes plz show with some code based example?
-
Contributing Member
Re: Object for static class
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
-
Junior Member
Re: Object for static class
Generally we can have static inner classes only.
-
Junior Member
Re: Object for static class
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
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules