File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes static class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "static class" Watch "static class" New topic
Author

static class

surekha Nidadavolu
Greenhorn

Joined: Apr 15, 2005
Posts: 6
Why a class cannot be static?
Georgy Bolyuba
Ranch Hand

Joined: Feb 18, 2005
Posts: 162
And why not? It can be static.



class B is static.


SCJP 1.4 (100%) Done.<br />SCJD (URLyBird 1.2.3 Started)
Nidhi Dave
Greenhorn

Joined: Sep 06, 2005
Posts: 3
The only class you can declare static is a member class...
And this member class can be instantiated only in the context of the class which the member belongs to. If you want to avoid this , you can
declare the member class as static and you can use this class the same way as you do the top level (to which the member class belongs) class..
i.e the member class becomes a nested top level class..
surekha Nidadavolu
Greenhorn

Joined: Apr 15, 2005
Posts: 6
I want to know why the super class cannot be static at all...Can u pls give me an answer for this question..


Surekha :
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

You want to know why a top-level class can't be static? OK, I'll tell you -- but first you have to explain to me what that would mean. What would "public static class" mean, exactly, and how would it be different from "public class", for a top-level class?


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: static class
 
Similar Threads
static inner classes
Static class??
An anonymous class can be static?????
Static Class
outer class