1) why some interfaces are null(like Cloneable, without any methods) 2)while i am trying overriding functuality i found out that if the base class's func is public and the derived class 's or overridden func shouldn't be public,protected,friendly,or private.why is it so. 3)what is resource leak and memory leak. 4)are swings compatible with browser, if not what to make it compatible 5)whats the diff betwn java class and java bean
1) why some interfaces are null(like Cloneable, without any methods)
These empty interfaces (I wouldn't call them null) have no constants or methods. They are known as marker interfaces or tag interfaces and they are used to mark a class as implementing certain functionality. Usually this functionality is very general such that a more specific interface could not (or would be very hard to) define. An example use (other than the ones that exist in the Java platform) might be to define a Mutable marker interface for the Collection classes in java.util to identify when their, add and remove methods are implemented.
2) while i am trying overriding functuality i found out that if the base class's func is public and the derived class 's or overridden func shouldn't be public,protected,friendly,or private.why is it so.
That's not quite right. You must override a public method with another public method. You can't override it with a more restrictive access specifier, e.g. protected, private or package/default (not friendly, that's a C++ thing). I'm not sure exactly why this is the case. Anyone?
3) what is resource leak and memory leak.
Here are half a zillion definitions of "memory leak" from Google. A resource leak is basically the same thing except with some other resource such as file handles or database connections.
4) are swings compatible with browser, if not what to make it compatible
You can use Swing through a browser if you implement it using JApplet as the top-level container. However, it's probably not the best choice for web UI design. If your app is specifically for the web, and you want to use Java, then look to implement it using JSP. HTML/JSP gives you less control and fewer features than Swing, but is the most appropriate technology for the web and, perhaps most importantly, is what web users expect to see.
5) whats the diff betwn java class and java bean
According to the JavaBeans spec, found on Sun's JavaBeans page: "A Java Bean is a reusable software component that can be manipulated visually in a builder tool." JavaBeans conform to certain rules, e.g. their properties are accessible through getter and setter methods and they support certain types of event with well-defined behaviour.
You cannot override a method to be more restrictive - less visible - than the original because of a cranky rule that says anyplace a base class would work a derived class should also work. Say base class Animal has speak() and I decide that derived animal StarFish has no sound and try to override speak() to be private the compiler will complain. So we can write a method like:
and be assured that any subclass of Animal will have a public speak() method for me to call. The StarFish won't say much, but that's ok.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi