import java.util.Scanner;
class Rectangle {
Scanner scanner;
int tlx;
int tly;
int brx;
int bry;
int px;
int py;
void doRectangle () {
scanner = new Scanner (System.in);
tlx = scanner.nextInt ();
tly = scanner.nextInt ();
brx = scanner.nextInt ();
bry = scanner.nextInt ();
px = scanner.nextInt ();
py = scanner.nextInt ();
if (tlx>brx || tly>bry){
System.out.println("error");
return;
}
if (tlx <= px && px <= brx && tly <= py && py <= bry) {
System.out.println("inside");
} else {
System.out.println("outside");
}
}
}
请帮助我,我编译了一百万次然后运行并始终相同的东西静态错误:此类没有静态void main方法接受String []。请帮助我,我真的想知道我的错误在哪里或我错过了什么
感谢您的建议!
答案 0 :(得分:9)
错误消息告诉您出了什么问题。你需要一个主要的方法:
public static void main(String[] args) {
// program starts here
}
从这里,您可以运行您拥有的代码:
Rectangle r = new Rectangle();
r.doRectangle();