import java.util.*;public class start { public Hashtable table; public Agent agent; public static void main(String[] args) { start st=new start(); st.agent=new Agent(); st.table.put("hello",st.agent); } }package referance; import java.io.*; import java.lang.Thread; import java.security.*;public class Agent extends Thread{ public Agent() { System.out.println("Hello world,I am constructor."); } public void run() { System.out.println("Father begin to run. "); } }java.lang.NullPointerException at referance.start.main(start.java:11)Exception in thread "main" Hello world,I am father constructor. 请指教
public Hashtable table;
public Agent agent; public static void main(String[] args) {
start st=new start();
st.agent=new Agent();
st.table.put("hello",st.agent);
}
}package referance;
import java.io.*;
import java.lang.Thread;
import java.security.*;public class Agent extends Thread{
public Agent()
{
System.out.println("Hello world,I am constructor.");
}
public void run()
{
System.out.println("Father begin to run. ");
}
}java.lang.NullPointerException at referance.start.main(start.java:11)Exception in thread "main" Hello world,I am father constructor.
请指教