我是java的新手。我有一个以下的程序
import java.util.Scanner;
import java.awt.*;
import javax.swing.JFrame;
public class UserInterfaceTriangle {
public static void main (String[] args)
{
int x0;
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter x coordinate of first point: ");
//x0 = keyboard.nextInt();
Points p1= new Points(5,3);
Points p2= new Points(6,6);
Points p3= new Points(2,-2);
Triangle n1= new Triangle (p1,p2,p3);
n1.DrawTriangle();
}
}
如果我取消注释,程序不会绘制三角形。
x0 = keyboard.nextInt()
但是粘贴在上面可以正常工作。