public class Cat{
private Integer id;
private String name;
public void setId(Integer id){
this.id=id;
}
public Integer getId(){
return this.id;
}
}
public static void main(String[]args){
Cat cat;//nullpointerexception
// you should change Cat c=new Cat();
cat.getId();
}