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

¶ÔJavaÖнӿڵijõ²½Àí½â

ÏÖÔÚ×ÔѧJavaÖУ¬½áºÏÍøÉÏËÑË÷¡¢ÊéÉÏÃèд¼°×Ô¼ºµÄÀí½â£¬¶Ô½Ó¿ÚÓÐһЩÀí½â£¬Ï£ÍûÓë´ó¼Ò·ÖÏíһϡ£
½Ó¿ÚÊDz»Í¬ÀàµÄÏàͬ·½·¨µÄ¼¯ºÏ£¬²»¹ýËüÖ»¸ø³öÁË·½·¨µÄ¶¨Ò壬²¢Ã»Óиø³ö¾ßÌåµÄʵÏÖ¡£
¾ÍÏñһȺɱÊÖ£¬ÓÐÈ˽ÐËûȥɱһ¸öÈË£¬ËûÃÇÓÐÏàͬµÄÐÐΪ——ɱËÀÄ¿±ê£¬Õâ¾ÍÏñ½Ó¿Ú£¬²»Í¬µÄɱÊÖ»áÓò»Í¬µÄÊֶΣ¬ÕâÈç·½·¨µÄ¾ßÌåʵÏÖ£¬µ±È»×÷Ϊ¹ÍÓ¶Õߣ¬ËûÃDz»ÐèÒªÁ˽âÕâЩ£¬Ö»ÒªÖªµÀ½á¹û¾ÍÐУ¬É±ËÀÄ¿±ê¡£ËùÒÔ˵½Ó¿ÚÀûÓÚ¹ÜÀí£¬ÈÝÒ×Àí½â¡£
¼ÙÈçÓÐÁ½¸öɱÊÖ£¬Ò»¸öϲ»¶´Ìɱ£¬ÁíÒ»¸öϲ»¶¶¾É±£¬ÓÐÈçϳÌÐò£º
public class Person {
 private String name;
 
 public Person()
 {
  name = "no name";
 }
 
 public Person(String thename )
 {
  name = thename;
 }
 
 public String getName()
 {
  return name;
 }
}
public interface KillMethod {       /*½Ó¿Ú*/
 public void kill(Person p);
}
public class Killer1 implements KillMethod {
 private String name;
 
 public Killer1(String thename )
 {
  name = thename;
 }
 
 public String getName()
 {
  return name;
 }
 
 public void kill(Person p)
 {
  System.out.println("´Ìɱ" + p.getName());
 }
}
public class Killer2 implements KillMethod {
 private String name;
 
 public Killer2(String thename )
 {
  name = thename;
 }
 
 public String getName()
 {
  return name;
 }
 
 public void kill(Person p)
 {
  System.out.println("¶¾É±" + p.getName());
 }
}
public class TestAll {
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  
  Person victim = new Person("ÙøÕþ");
  Killer1 killer1 = new Killer1("¾£éð");
  System.out.print(killer1.getName());
  killer1.kill(victim);
  
  Killer2 killer2 = new Killer2("¸


Ïà¹ØÎĵµ£º

Java IO¿ò¼Ü

¿É´ÓIOµÄÀà²ã´Î£¬IO¿ò¼ÜµÄÉè¼ÆģʽÀ´ÂÛÊö¡£
×ÜÌåÀ´Ëµ£¬IO¿ÉÒÔ·ÖΪ×Ö½ÚÁ÷ºÍ×Ö·ûÁ÷£¬²»Í¬ÔÚÓÚ×Ö·ûÁ÷ÓÉ×Ö½ÚÁ÷°ü×°¶øÀ´£¬ÔÚIO¶ÁÈëÖ®ºó¾­¹ýJVM´¦Àí£¬°Ñ×Ö½ÚÁ÷ת»»³É×Ö·ûÁ÷¡£¶ø×Ö·ûÁ÷µÄ×Ö·û²ÉÓÃÄÄÖÖ×Ö·û±àÂëʵÏÖÓÉJVMĬÈϱàÂë¾ö¶¨¡£
¶øÿ¸öÁ÷¶¼·ÖÊäÈëºÍÊä³ö£¬ËùÒÔ£¬×ÜÌåÀ´Ëµ£¬IOÓÐËĸö¶¥²ãÀࣺ
InputStream
OutputStream ......

JavaÓïÑÔ»îµÄjdk¡¢jreºÍ²Ù×÷ϵͳ°æ±¾µÈÐÅÏ¢

      System.out.println(System.getProperty("java.version")); //java°æ±¾ºÅ
System.out.println(System.getProperty("java.vendor")); //JavaÌṩÉÌÃû³Æ
System.out.println(System.getProperty("java.vendor.url")); //JavaÌṩÉÌÍøÕ¾
System.out.println( ......

javaÊý×ֵĸñʽ»¯

1)   ¸ñʽ»¯ÕûÊý(°Ñ¸¡µãÊýת»¯ÎªÕûÊý)
       NumberFormat nf = NumberFormat.getIntegerInstance();
       double v=12.6;
       System.out.println(nf.format(v));
       Êä³ö½ ......

JavaÃÕÌâ1 1ÆæÊýÐÔ

ÏÂÃæµÄ·½·¨Òâͼȷ¶¨ËüÄÇΨһµÄ²ÎÊýÊÇ·ñÊÇÒ»¸öÆæÊý¡£Õâ¸ö·½·¨Äܹ»ÕýÈ·ÔËתÂð£¿
public static boolean isOdd(int i){
return i % 2 == 1;
}
ÆæÊý¿ÉÒÔ±»¶¨ÒåΪ±»2Õû³ýÓàÊýΪ1µÄÕûÊý¡£±í´ïʽ i % 2 ¼ÆËãµÄÊÇ i Õû³ý 2 ʱËù²úÉúµÄÓàÊý£¬Òò´Ë¿´ÆðÀ´Õâ¸ö³ÌÐòÓ¦¸ÃÄܹ»ÕýÈ·ÔËת¡£Òź¶µÄÊÇ£¬Ëü²»ÄÜ£»ËüÔÚËÄ·ÖÖ®Ò»µÄʱ¼äÀï·µ»Øµ ......

JavaÃæÊÔÌâ

Java»ù´¡·½Ãæ: 
1¡¢×÷ÓÃÓòpublic,private,protected,ÒÔ¼°²»Ð´Ê±µÄÇø±ð
´ð£ºÇø±ðÈçÏ£º
×÷ÓÃÓò           µ±Ç°Àà       Í¬Ò»package  ×ÓËïÀà       ÆäËûpackage
public& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ