The output of the program written is Null. I cant find where is the error in here? Can anyone explain the following code and why does it return Null?
class methodexample
{
int number;
String name;
void data()
{
int number=5;
int name="Rahul";
}
void display()
{
System.out.println("Number is" +number);
System.out.println("Name is " +name);
}
public static void main(String args[])
{
methodexample m=new methodexample();
m.data();
m.display();
}
}