Tip Bank

DevX - Software Development Resource

Garbage Collection

Question: Is it possible to preserve an object from garbagecollection (to live as long as the applet)? Answer: Yes, it is possible to preserve an object from garbage collection andlive

DevX - Software Development Resource

byte array to int conversion

Question: I have just read a packet of data into a byte array from a socket. At offsets 5-8, 9-12, and 13-16 are binary integers. How can I get them

DevX - Software Development Resource

Multithreading Applets—the Right Way

The canonical design of multithreaded applets is inherently flawed. You know what I’m talking about: the run method with the repaint/sleep statements embedded in a while(true). Any self-respecting operating systems

DevX - Software Development Resource

Conversion Operators

Sometimes, an object must be converted into a built-in type (for instance, a string object passed as an argument to C function such as strcmp()) : //file Mystring.hclass Mystring {

DevX - Software Development Resource

Correct syntax for automatic object instantiation

When you instantiate an automatic object (e.g., on the stack) using its default constructor, mind that the correct syntax is: String str; //correct And not this: String str(); //entirely different

DevX - Software Development Resource

IsA or HasA?

When designing a class hierarchy, you may face a decision between inheritance (aka IsA ) vs. containment (aka HasA) relation. For instance, if you are designing a Radio class, and

DevX - Software Development Resource

A base class destructor should be virtual

If a class may serve as a base class for others, its destructor should be virtual. This ensures RTTI support for objects of this class and objects derived from it,