devxlogo

Tip Bank

Convert a Double into an Int

There are many things you can do to convert a float to an int depending upon what results you expect. If you want to use the built-in language conversions, you

Send Output to Printer

How do I send the output of my program to the standardprinter installed in Win95 or NT? Is it possible using the

Replicating the END command in C++

Suppose I have one function that calls about five or so subfunctions. In one of the subfunctions, I have an if statement: that if a=0, go on to the rest

Helping the Java Garbage Collector

When you create an object in Java, such as in the following code: Button b = new Button(); Java creates a new Button object in memory and sets the value

Include Test Code in Your Classes

It is important for developers to test code that they write to insurethat they are meeting the specifications for their application. Oftentest code is built in a separate program which

Allow the Java Compiler to Remove Debug Code

The Java compiler will optimize your application by removing code thatcan never be executed. If you include a class in your application suchas the following: public class Debug{ public static

Increase Code Reusability

Instead of exposing fields of a Java class, such as in thiscode: public class Person{ public String firstName; public String lastName;} use private fields and provide access to the information

Create a Single Instance of an Object

There are situations when you need to insure that only a single instanceof an object is created in a program. Examples of this include aconnection to a database system, a