import java.util.*;
import javax.annotation.*;
public class Test6
{
private static final @NonNull Map<Test6,Integer> cache= new HashMap<Test6, Integer>();
private final @NonNull String id;
public Test6(@NonNull String id)
{
this.id = id;
}
public static void main(String args[])
{
Test6 foo = new Test6("a");
cache.put(foo,1);
// System.out.println("inside foo******"+cache.get(foo));
// System.out.println("inside******"+cache.get(new Test6("a")));
System.out.println(cache.get((new Test6("a"))).intValue());
}
}
我应该实现一些防止此程序崩溃的方法吗?Java程序崩溃
您可以发布一些关于您在程序崩溃时获得的错误类型的其他信息吗? – therealrootuser 2014-10-09 06:11:12
你能更具体吗?你在尝试什么? – 2014-10-09 06:12:01
你是什么意思?它的程序不是物理服务器。您可能会在.intValue()调用中获得NullPointerException。我们称之为异常而不是崩溃。 – Nazgul 2014-10-09 06:19:27