There is no equivalent for typedef in Java. And subclassing from Integer is a good idea, but indeed, you can't. It's final. You can make a new class:
[javaclass]
public class L_Handle {
int integerValue;
public L_Handle(int integerValue) {
this.integerValue = integerValue;
}
public int intValue() {
return integerValue;
}
}
[/javaclass]
But indeed, this is very poor.
What can make this a richer class, from an OO standpoint, is that this L_Handle indeed handles L's, whatever an L may be
Please check out the classes java.net.InetAddress, java.net.URL. Both classes could just have been a subclass of String (if technically possible), and are in fact handles. However, they can do a lot more. E.g. an URL can give you an output stream and do other things.
The message is: think OO. A handle is not an integer (!isA => not a subclass). One could have chosen a name for a handle too. An L_Handle handles L's, what can an L do for you? Put that functionality in the class above, and you'll see in which way a C programmer thinks differently from a Java programmer. (Note that it would have been better that in C++, the same OO reflexes would have been valid)
Bookmarks