2日間JAVA知識まとめ
6919 ワード
JAVA , , , 。
1.JAVA , , , C++ 。
2.Unicode
3. : 0 , 013,029
: 0x 0X , 0xA3,0X1b
4. : + E +
15E4 = 15 * 10^4
26E-4 = 26 * 10^(-4)
5. : final float PI = 3.1415;
final public int MAX = 100;final “ ” , , c++ const
6. : ,
int c[][];
c = new[3][];
c[0] = new int[1];
c[1] = new int[3];
c[2] = new int[5];
length
:c.length :c[0].length
7. (static) : ,
Student s1;
Student.count s1.count
8.main() , ,
9. , , ,
interface inf{...}
class father implements inf{...}
class son extends father{...}
...main(...){
inf s1 = new inf();
inf s2 = new inf();
s1 = new father();
s2 = new son();
}
10. throws : , throws XXException
11. :
System.in ,
BufferedReader , System.in
InputStreamReader , BufferedReader System.in
:
InputStreamReader iin = new InputStreamReader(System.in);
BufferedReader bin = new BufferedReader(iin);
12. AWT
Component plain
Container boln
Window italic
Panel
Frame
Dialog
13. AWT
(Button ):
Class Myclass extends Frame implements ActionListener{
static Myclass frm = new Myclass();
static Button btn1;
....
...main(...){
frm.setTitle("FrmName");
btn1 = new Button("ButtonName");
btn1.addActionListener(frm);//
frm.add(btn1);
frm.setvisible(true);
}
public void actionPerformed (ActionEvent e){
//
}
}
14. Swing
, ActionListen
:
......
......
gre = new JMenuItem("green");
gre.addActionListener(new Handler1());
lb1 = new JLabel("Menu Example");
......
class Handler1 implements ActionListener{
public void actionPerformed (ActionEvent e){
JMenuItem mi = (JMenuItem) e.getSource();
if(mi == gre)
lb1.setForgeground(color.green);
}
}
15. Applet
init,start,stop,destory,paint
16. :
: Thread ,Runnable
Sleep(); ,
Synchronized : public synchronized static void Sub(int m), Sub() , Sub(), Sub() , Sub()