I'm going through the book Just Java 2 but am evidently missing something basic. These are two separate projects. I've generated a JAR for the second and added it to the first's build path. The correct areas are printed but the compiler generates these warnings. How would these be resolved?
// -----------------------------------------------------------
// Testing.java
// -----------------------------------------------------------
public class Testing {
public static void main(String[] args) {
RectangleDFC r = new RectangleDFC(3, 4);
System.out.println(r.Area());
// WARNING: The static method Area() from the type RectangleDFC
// should be accessed in a static way
r.SetSides (10, 10);
// WARNING: The static method SetSides(int, int) from the type
// RectangleDFC should be accessed in a static way
System.out.println(r.Area());
// WARNING: The static method Area() from the type RectangleDFC
// should be accessed in a static way
}
}
// -----------------------------------------------------------
// RectangleDFC.java
// -----------------------------------------------------------
public class RectangleDFC {
int side1;
int side2;
RectangleDFC(int s1, int s2) {
SetSides(s1, s2);
}
public void SetSides(int s1, int s2) {
side1 = s1;
side2 = s2;
}
public int Area() {
return side1 * side2;
}
}