Hi..
I get a null pointer exception error. Please give me a solution as how to access this. The code snippet is as follows.
I get a null pointer exception error. Please give me a solution as how to access this. The code snippet is as follows.
Code:
public class x
{
private String y;
public String gety()
{
return y;
}
public void sety(String m)
{
this.y = m ;
}
}
public class a
{
x ax = new x();
ax.sety("Hai");
}
public class z
{
a az = new a();
System.out.println(za.ax.gety()); //null Pointer exeption
}
Comment