devxlogo

Tip Bank

Struct assignment

Both standard C and Standard C++ support struct assignment using = . In fact, C++ programmers are often surprised to discover that assignment operator applies also to plain structs, and

Object I/O

Question: How can i add many java objects to a file then retrieve them as Java objects from the file? Answer: Java 1.1 introduced a concept called serialization. Serialization isa

Constant pointers

There are cases when you need to define a constant pointer to a variable/object; for instance, when taking a function address, or when you want to protect a pointer from

Namespaces are open

Unlike structs, classes, enums, and unions, the enclosing brace of a namespace definition does not prohibit you from further extensions to that namespace. A namespace can be extended this way:

Single bit assignment

Question: Is there an easy way to assign each bit in a byte, and how do Iaccess those bits individually? Answer: Usually, if you come from a C programming background,

Java OOP

Question: What exactly is a Factory or Factory class? Answer: A Factory is a class that you use to create sets of related objects withoutexplicitly invoking their constructors. You usually

Unix Signal Handling

Question: Is there a way in Java to handle Unix signals(i.e. to trap a Control C signal)? Answer: You can handle Unix signals only by writing native code. However, theJava

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