I can't run this program.I tried editing the run configuration,marked src folder directory as resource root,again test resource root, but still it won't work.. although building is possible.
I can't run this program.I tried editing the run configuration,marked src folder directory as resource root,again test resource root, but still it won't work.. although building is possible.
You don't need to use class Test() in class EncapsulationExample{}
public class EncapsulationExample {
private String name;
private int x;
public String getName() {
return name;
}
public int getValue(){
return x;
}
public void setName(String name){
this.name = name;
}
public void setValue(int x){
this.x = x;
}
public static void main(String[] args) {
EncapsulationExample e1 = new EncapsulationExample();
e1.setName("Aara");
e1.setValue(10);
System.out.println(e1.getName()+e1.getValue());
}
}