class Foo { String field; String field2; int hash = field.hashCode(); Foo(String f2) { field2 = f2; } void someMethod() { if (field == null) { System.out.println("impossible"); } if (field2 == null) { System.out.println("impossible"); } } }