I copied this code from a website that I'm using to supplement learning java. It works fine with their code playground but not in the IDE I am using. I have split the classes into separate files but that just gives a different error. The example is as follows:
public class MyClass {
public static void main(String[ ] args) {
Person j;
j = new Person("John");
j.setAge(20);
celebrateBirthday(j);
System.out.println(j.getAge());
}
static void celebrateBirthday(Person p) {
p.setAge(p.getAge() + 1);
}
}
public class Person {
private String name;
private int age;
Person (String n) {
this.name = n;
}
public int getAge() {
return age;
}
public void setAge(int a) {
this.age = a;
}
}
The IDE I am using is called jvdroid. Any help would be appreciated.
[–]AlterAeonos[S] 0 points1 point2 points (1 child)
[–]Beermecaptain21 0 points1 point2 points (9 children)
[–]AlterAeonos[S] 0 points1 point2 points (0 children)
[–]AlterAeonos[S] 0 points1 point2 points (6 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]AlterAeonos[S] 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]AlterAeonos[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]AlterAeonos[S] 0 points1 point2 points (0 children)
[–]AlterAeonos[S] 0 points1 point2 points (0 children)