Skip to main content

Posts

Showing posts from February, 2012

Protected access modifier in Java

A subclass only access a protected members of its parent class, if it involves implementation of its parent. But in a different package, it cannot access the protected member though parent instance. You can’t use a protected constructor in a class that extends the constructor’s class, other than via an implicit or explicit super() to invoke the protected constructor. http://www.stevideter.com/2008/05/04/understanding-the-protected-access-modifier-and-inheritance-in-java/ http://mindprod.com/jgloss/protectedscope.html

Java serialization in class hierarchy (inheritance)

There are two cases for Java serialization in class hierarchy. Suppose we have two classes : SuperC and SubC. ( It does not matter whether SuperC is abstract class or not ) Case 1: Super class (SuperC) implements interface "Serializable". This case is simple. The sub class does not need to implement interface "Serializable". package serializable; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; abstract class SuperC implements Serializable { int supervalue; public SuperC() { } public SuperC(int supervalue) { this.supervalue = supervalue; } public String toString() { return "supervalue: " + supervalue; } } class SubC extends SuperC { int subvalue; private static final long serialVersionUID = 201111291028L; public SubC(int supervalue, int subvalue) { super(supervalue); this.subvalue = subvalue;

Apache Ant tutorial

https://www6.software.ibm.com/developerworks/education/j-apant/j-apant-ltr.pdf http://ideoplex.com/focus/java#ant TortoiseSVN Ant 实现自动化更新和发布 http://lengjing.iteye.com/blog/1158351 http://www.javapractices.com/topic/TopicAction.do?Id=135 Project dependency http://www.exubero.com/ant/dependencies.html Sample Ant script http://www.javapractices.com/topic/TopicAction.do?Id=135