Discussion:
[問題] java compiler的問題..
(时间太久无法回复)
不告訴你..
2007-03-23 13:41:01 UTC
Permalink
小弟剛學java不久,
昨天再試寫 計算機 程式的時候,
compiler 盡然出現

嚜磨mport java.awt.*;

這個錯誤,是在第一行,
我第一行是寫

import java.awt.*;

怎麼找都找不到錯誤,請問有人發生過同樣的問題嘛?
如果compiler出現正常訊息我應該找的出來,,
可是出現中文字我就不知道該怎麼解決了@@

我的程式碼如下

import java.awt.*;
import java.awt.event.*;

public class Calculator implements ActionListener
{
TextField tf = new TextField();
String[] ary1 =
{"7","8","9","-","4","5","6","+","1","2","3","*","0",".","/","="};
Button[] btn = new Button[ary1.length];

public Calculator()
{
Frame f = new Frame("Calculator");
f.setSize(200,250);
f.add(tf,"North");
Panel p = new Panel();
f.add( p );
p.setLayout(new GridLayout(4,4,4,4));
for(int i=0 ; i<ary1.length ; i++){
btn[i]= new Button(ary1[i]);
p.add(btn[i]);
btn[i].addActionListener(this);
}//for
f.setVisible(true);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});

}

public static void main(String[] args)
{
new Calculator();
}//main

public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
tf.setText(cmd);
}
}//class



--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.115.236.176
ha(ruhi|yate)ism
2007-03-23 14:53:16 UTC
Permalink
�� �ޭz�mdrinks (���i�D�A..)�n���ʨ��G
: import java.awt.*;
�ЧA�b�O�ƥ������t�s�s��

�b�u�s�X�v���̿�ANSI �s�ɧY�i

--
�o���M�O�s���F��BOM��UTF-8...

--
�Ե^�G�u�e���I�A�u���N�o�˳Q���輤�����l�޹L�h�F��?!�v
���G�u�u�n���ۤk���\�X�ˤ���ˤl�A�Ҧ����n���O�N�����K�A���G�@�I�����a�ڡC�v
�Ե^�G�u���D�A�S���k�H���L�Y�F��?!�v
���G(�_�M�D)�u�S���C�b�`���Y���B�ͬ��Y�����ǥ����e�A�S�����تF���C�v
�С�������Ƿǵȸ������Ƿǵ �ĤG��

--
�� �o�H��: ���������~�{(ptt.cc)
�� From: 192.192.197.115

Loading...