Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Javaʼþ´¦ÀíµÄ4ÖÖ·½·¨

 µÚÒ»ÖÖ ×ÔÉíÀà×÷Ϊʼþ¼àÌýÆ÷
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
*Javaʼþ´¦Àí»úÖÆ:×ÔÉíÀà×÷Ϊʼþ¼àÌýÆ÷
*@author Winty(wintys@gmail.com)
*@version 2008-12-3
*/
class ThisClassEvent extends JFrame implements ActionListener{
JButton btn;
public ThisClassEvent(){
super("Javaʼþ¼àÌý»úÖÆ");
setLayout(new FlowLayout());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
btn=new JButton("µã»÷");
btn.addActionListener(this);
getContentPane().add(btn);
setBounds(200,200,300,160);
setVisible(true);
}
/**************************************/
public void actionPerformed (ActionEvent e){
Container c=getContentPane();
c.setBackground(Color.red);
}
/**************************************/
public static void main(String args[]){
new ThisClassEvent();
}
}

 
µÚ¶þÖÖ ÄÚ²¿Àà×÷Ϊʼþ¼àÌýÆ÷
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
*Javaʼþ´¦Àí»úÖÆ:ÄÚ²¿Àà×÷Ϊʼþ¼àÌýÆ÷
*@author Winty(wintys@gmail.com)
*@version 2008-12-3
*/
class InnerClassEvent extends JFrame{
JButton btn;
public InnerClassEvent(){
super("Javaʼþ¼àÌý»úÖÆ");
setLayout(new FlowLayout());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
btn=new JButton("µã»÷");
btn.addActionListener(new InnerClass());
getContentPane().add(btn);
setBounds(200,200,300,160);
setVisible(true);
}
/*ÄÚ²¿Àà*********************************/
class InnerClass implements ActionListener{
public void actionPerformed (ActionEvent e){
Container c=getContentPane();
c.setBackground(Color.red);
}
}
/**************************************/
public static void main(String args[]){
new InnerClassEvent();
}
}

 
µÚÈýÖÖ ÄäÃûÄÚ²¿Àà×÷Ϊʼþ¼àÌýÆ÷
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
*Javaʼþ´¦Àí»úÖÆ:ÄäÃûÄÚ²¿Àà×÷Ϊʼþ¼àÌýÆ÷
*@author Winty(wintys@gmail.com)
*@version 2008-12-3
*/
class Ano


Ïà¹ØÎĵµ£º

java date

//¼òµ¥µÄjavaÈÕÆÚ¸ñʽ¿ØÖÆ
 java.Text.SimpleDateFormat format = new java.Text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss");//ÄãÏëÒªµÄ¸ñʽ
//×¢ÒâÔµÄλÖÃÒª´óдµÄMM  Òª²»¾Í¿´µ½µÄ²»ÊÇÕýÈ·ÏÔʾ£¬¿ÉÒÔ°ÑÄãÏëҪת»»µÄÈÕÆÚת»»ÎªÏàÓ¦µÄ¸ñʽ°¡
format.format(new java.util.Date());//dateΪÈÕÆÚÐÍÊý¾Ý£¬¿ÉÒÔÈÎÒ ......

Java HashMapºÍTreeMapµÄÅÅÐòÎÊÌâ×ܽá

Map´æ´¢µÄÊÇkey->valueµÄÖµ¶Ô£¬keyµÄÖµÊÇΨһµÄ£¬¶øvalueµÄÖµ¿ÉÒÔÖظ´¡£Í¨³£Ê¹ÓõÄÊÇHashMap»òTreeMap£¬Èç¹û¿¼ÂÇÐÔÄÜ£¬Ê¹ÓÃHashMap¡£TreeMapʹÓúìºÚÊ÷ʵÏÖ£¬±£ÁôÓÐkeyֵ˳ÐòÐÔ£¬»á×Ô¶¯°´ÕÕkeyÖµÅÅÐò¡£
ĬÈÏÊÇ°´ÕÕkeyÖµµÄÉýÐòÅÅÐò£¬keyÖµ±ØÐëʵÏÖ Comparator½Ó¿Ú¡£Èç¹ûÏ£Íû°´ÕÒÒ»¶¨¹æÔòÅÅÐò£¬ÔòÐèÒªÖØж¨Òåcompareº¯Êý ......

¹ØÓÚc#ºÍjavaÖÐÊý×éµÄ±È½Ï

 javaÖÐʹÓöþά Êý×é
ognNf_v
public class Array2D...{
m @EvM)y0e2r
s
    public static void main(String[] args)...{JAVAÖÐÎÄÕ¾ÉçÇøÃÅ»§ ~j!lSR ^ z5bR5O
        int myInt[][]=new int[5][10];
@XH3ao\
        ......

javaÖÐfloat/double¸¡µãÊýµÄ¼ÆËãʧ¾«¶ÈÎÊÌâ

 javaÖи¡µãÊýµÄ¼ÆËã
½ñÌìÔÚÊýÖµ¼ÆËãʱÅöµ½Ò»¸öÎÊÌâ.³ÌÐòÈçÏÂ:
  double a = (3.3-2.4)/0.1;
  System.out.println(a);
Äã¿ÉÄÜÈÏΪ½á¹ûºÜ¼òµ¥,²»¾ÍÊÇ9Âï,ÊÇÊÂʵÉÏ,½á¹ûΪ:8.999999998,ΪʲôÄØ?ÎÒ·­ÔÄÁËһЩ×ÊÁÏ,ÖÕÓÚÕÒ³öÁËÔ­Òò.
Ϊʲô¸¡µãÊý»á¶ªÊ§¾«¶È£¿ 
Ê®½øÖÆÊýµÄ¶þ½øÖƱíʾ¿ÉÄܲ»¹»¾«È·
......

javaʵÏÖÑ­»·×óÒƺÍÓÒÒƵļòµ¥Ëã·¨

 byte a=112,ÓóÌÐòʵÏÖ£¬½«ÆäÑ­»·×óÒÆÈýλºÍÓÒÒÆÈýλ¡£
112µÄ¶þ½øÖÆÔ­Âë:0111 0000
112Ñ­»·×óÒÆ3λºóµÄ¶þ½øÖÆÂë:1000 0011
112Ñ­»·ÓÒÒÆ3λºóµÄ¶þ½øÖÆÂë:0000 1110
ÏȽ«Ñ­»·×óÒƵijÌÐò´úÂë¸æËß´ó¼Ò:
public class TestCircle{
 public static void main(String args[]){
  byte x=112;
 & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ