我正在阅读Just Java 2这本书,但显然缺少一些基本的东西.这是两个独立的项目.我已经为第二个生成了JAR并将其添加到第一个构建路径中.打印正确的区域但编译器会生成这些警告.这些如何解决?
// -----------------------------------------------------------
// 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
// …Run Code Online (Sandbox Code Playgroud)