A place for Extreme Java JEE developers to read latest Java tutorials. The Extreme Java blog is for Java application development, J2EE application development and web technologies in the Java world.
Jun 18, 2008
enums in java
------------------------------------------------------------------------------------
semicolon at the end of enums is optional
enums can be a class outside the non-inner public class or a memeber of some class but not that of a function
the enum values are constant
enums can have constructors. enums can have instance variables and enums can have functions
a single enum value can have content specific body which can give some particular behavious only for that enum constant. If the enum as whole also provides the same function, then that function is considered overriden for the enum value that has content specific body. semicolon is necessary for the content body of an enum value.
enum constructors are called automatically and can't be invoked in the code
Jun 17, 2008
interfaces in java are more of a contract
Interfaces can be used to co-relate classes which want to share a contract regarding something as those implementing the Serializable interface. But then inheritance also means contract as a MarutiCar extends Car. But the difference with interface is that the implementors of interface needn't have same hierarchy as in inheritance.
Say MarutiCar, GMCar and TataCar extend Car but only MarutiCar and GMCar implement the serializable interface and not TataCar. This means that MarutiCar and GMCar are in contract that they may be serialized but TataCar is not.
The difference is in usage of interfaces and not in overriding abstract methods.
Jun 13, 2008
published the article on JQuery
How by the way, JQuery is something easy JavaScript.