I have implemented the same code in my IDE but there is a error saying name cannot be resolved or it is not in field.
person class
package Lecture10;
public class person {
public static void main(String[] args) {
// TODO Auto-generated method stub
String name;
int age;
}
}
peraon_client
package Lecture10;
public class person_client {
public static void main(String[] args) {
// TODO Auto-generated method stub
person p1= new person();
person p2=new person();
p2.name="T";
p2.age=20;
System.out.println(p2.name);
System.out.println(p2.age);
}
}