devxlogo

Tip Bank

How to See If Data is Numeric or Non-numeric

In JavaScript you can use isNaN to check if the given data is numeric ornon-numeric.Syntax : isNaN(testdata)ReturnValue :True if the testdata is non-numeric.False if the testdata is numeric.Here’s an example:

Methods of Class Instantiation

The following methods can be used for creating new instance of your classes, depending on your specific needs. import java.lang.ClassLoader;import java.net.URLClassLoader;import java.net.URL;public class InstantiateClass { testFinally newInstance() throws Exception {

Using Verbose to Debug

Using the -verbose option during compilation and execution is very helpful&#151both for obtaining more information about the classes being loaded by the compiler and the interpreter and to find out

A Problem in Using Enumeration

Once you are finished iterating through the values of an Object implementing the Enumeration interface, the next time youtry to use hasMoreElements() it will return false. Many developers are not

How to Rethrow an Exception in Your Code

Use the fillInStackTrace() method to rethrow a Throwable type of exceptional condition in your code. This is useful if you want to rethrow a exception occurred while using a method

Creating a Numeric-Input JTextField

Validating user input that is typed into a JTextField can becumbersome, especially if the input string must be converted to anumeric value such as an int. By subclassing JTextField, however,

Boolean Literals

The keywords false and true are Boolean literals that evaluate to 0 and 1 respectively. Note that in other programming language, VB for instance, false equals -1 and true equals

Casting Pointers To Members

C++ allows casting a pointer to member functions of one type to another pointer to member, as long as the signatures of the two match. However, the results of such