I was not understanding what is going on the output of below code is 0 0.But i was expecting it to be 45 12.Can someone explain the reason for such output.
Code:
import java.util.*;
import java.io.*;
import java.lang.*;
class person{
static int pn,py;
}
class patient extends person{
public patient()
{
pn=45;
py=12;
}
static void fun()
{
System.out.println(""+pn+py);
}
public static void main(String args[])
{
fun();
}
}
Comment