[jdom-interest] class Node vs. interface Node

Noam Tamim noamt at yahoo.com
Wed May 2 04:54:15 PDT 2001


If we want to, we CAN prevent users of subclassing Node. For that, we need
Node to be an abstract class rather than an interface:

// Node.java
package test;

public abstract class Node {
 Node() {
  // default access - prevent subclassing by other packages

// Element.java
package test;

public class Element extends Node {
    // ...

// OtherNode.java
package test2;

import test.*;

public class OtherNode extends Node {
    // compilation error: Node() has default access in test.Node

 - Noam.

More information about the jdom-interest mailing list