java.lang.NullPointerException
Arghhhhh. Can anyone see what i am doing wrong. :D The static format method takes a String and an Object[] as arguements. public static String format(String pattern, Object[] arguements) I have to create a Long object and put that into an Object array to pass to the format method but i keep getting a NullPointerException.
Any ideas why?
Sun should have just overloaded the format method to take various datatypes instead of an Object[] array. :rolleyes:
Code:
class TimeTracker extends TimerTask{
private Timer timer;
private Long l;
private TimeTrackerTest t;
private long millis;
Object[] o;
public TimeTracker(JTextField jtf){
this.t = t;
o = new Object[1];
timer = new Timer(true);
}
public void run(){
try{
millis = scheduledExecutionTime();
l = new Long(millis);
o[0] = l;
t.jtf.setText(MessageFormat.format("{0}",o));
}catch(Exception e){System.err.println(e);}
}
}