How it Works :
It is a very small class but works quite well as a debugging help .If you run your program
from the Console , you want to output many messsages and Exception Stacks to keep tab of what's happening.But , if you have a lot of classes in your program, here is a tailormade and simple solution to get the source of the message , too.
The Code :
/********************* start hlptool.java *************************************/
/*
Copyright : Rahul Singh (raahul@www.com)
Source : http://go.to/raahul
*/
import java.io.*;
class hlptool
{
static void pf(Object O,String S){
System.out.println("<<"+(O.getClass()).getName()+" : " + S+" >> ");
}//end method helpertool
}
/*
To use this class from another class:
[[ add it to your classpath first (Maybe permanently) ]] Then -
1.instead of [ System.out.println("text") ], write
[ hlptool.pf(this,"text") ]
and
2. instead of [ System.out.println(exceptionE.getMessage() ) ],
write [ hlptool.pf(this," threw following exception :" );
exceptionE.printStackTrace() ; ]
The result would look like :
[ < InvokingclassName : yourtext > ]
*/
/********************* end hlptool.java *************************************/
| To Change the color scheme of this page, click INDEX |