0
我試圖用線條填充三角形。挑戰不在於使用填充多邊形,而是使用循環並填充線條。無論如何,我還沒有弄清楚這個循環。我將創建ints並使用for循環添加到它們。填充三角形/編譯器錯誤
我還設置了休息了,我得到這個荒謬的編譯器錯誤,所有的地方:
error: not a statement
error: ';' expected
這很奇怪,因爲我已經初始化的整數。有 ;在那裏。
import javax.swing.JApplet;
import java.awt.*;
public class Tri extends JApplet
{
public static void main(String[] args)
{
int 1x = 0;
int 1y = 140;
int 2x = 120;
int 2y = 140;
int 3x = 60;
int 3y =0;
public void paint (Graphics page)
{
page.drawLine (1x, 1y, 2x, 2y);
page.drawLine (2x, 2y, 3x, 3y);
page.drawLine (3x, 3y, 1x, 1y);
}
}
}
'import java.awt。*'?我希望你不打算在你的代碼中的任何地方使用'List' ... – corsiKa