你的括号错了,请用你的代码的格式工具。我发布下面的固定代码。请注意,条件必须包含在()括号内。
if (condition) { ... }
// In case there are complete calculations within condition
if ((condition) && (condition) && (condition)) { ... }
而且它肯定说:
non-static method cannot be referenced from a static context
这个错误应该因为你使用的Scanner实例,这不是静态的,以及去除static关键字是固定的。
Scanner sc = new Scanner(System.in);
public void run() {
int object;
System.out.println("input:");
object = sc.nextInt();
if (object/100000 >= (object/1000) % 10 || (object/10000) % 10 <= (object/100) % 10) {
System.out.print("inside");
} else if (((object/100000 <= (object/10) % 10) &&
((object/10) % 10 <= (object/1000) % 10) &&
((object/100) % 10) <= object % 10) &&
(object % 10 <= (object/10000) % 10))
{
System.out.print("inside");
} else {
System.out.print("outside");
}
}
public static void main(String[] args) {
new Rectangle().run();
}