I have just begun to look at Java and in a tutorial, there is an example which uses eclipse as the ID. On my home computer i entered the following:
package intro.core;
public class Adult {
protected int age;
protected String name;
protected String race;
protected String gender;
public static void main(String[] args) {
Adult myAdult = new Adult();
System.out.println("Name:" + myAdult.name);
System.out.println("Age:" + myAdult.age);
System.out.println("Race" + myAdult.race);
System.out.println("Gender:" + myAdult.gender );
}
}
and i get the error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at Adult.main(Adult.java:2)
but if i enter it at work, it works fine.
Does anyone have any ideas what could be wrong. If i was using different versions of Java, would that be the cause?
package intro.core;
public class Adult {
protected int age;
protected String name;
protected String race;
protected String gender;
public static void main(String[] args) {
Adult myAdult = new Adult();
System.out.println("Name:" + myAdult.name);
System.out.println("Age:" + myAdult.age);
System.out.println("Race" + myAdult.race);
System.out.println("Gender:" + myAdult.gender );
}
}
and i get the error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at Adult.main(Adult.java:2)
but if i enter it at work, it works fine.
Does anyone have any ideas what could be wrong. If i was using different versions of Java, would that be the cause?