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

JavaÖеÄÉÖÆÓëdz¸´ÖÆ

1£®Ç³¸´ÖÆÓëÉÖƸÅÄî
¢Ådz¸´ÖÆ£¨Ç³¿Ë¡£©
±»¸´ÖƶÔÏóµÄËùÓбäÁ¿¶¼º¬ÓÐÓëÔ­À´µÄ¶ÔÏóÏàͬµÄÖµ£¬¶øËùÓеĶÔÆäËû¶ÔÏóµÄÒýÓÃÈÔȻָÏòÔ­À´µÄ¶ÔÏó¡£»»ÑÔÖ®£¬Ç³¸´Öƽö½ö¸´ÖÆËù¿¼ÂǵĶÔÏ󣬶ø²»¸´ÖÆËüËùÒýÓõĶÔÏó¡£
 
¢ÆÉÖÆ£¨Éî¿Ë¡£©
±»¸´ÖƶÔÏóµÄËùÓбäÁ¿¶¼º¬ÓÐÓëÔ­À´µÄ¶ÔÏóÏàͬµÄÖµ£¬³ýÈ¥ÄÇЩÒýÓÃÆäËû¶ÔÏóµÄ±äÁ¿¡£ÄÇЩÒýÓÃÆäËû¶ÔÏóµÄ±äÁ¿½«Ö¸Ïò±»¸´ÖƹýµÄжÔÏ󣬶ø²»ÔÙÊÇÔ­ÓеÄÄÇЩ±»ÒýÓõĶÔÏó¡£»»ÑÔÖ®£¬ÉÖÆ°ÑÒª¸´ÖƵĶÔÏóËùÒýÓõĶÔÏ󶼸´ÖÆÁËÒ»±é¡£
 
2£®JavaµÄclone()·½·¨
¢Åclone·½·¨½«¶ÔÏó¸´ÖÆÁËÒ»·Ý²¢·µ»Ø¸øµ÷ÓÃÕß¡£Ò»°ã¶øÑÔ£¬clone£¨£©·½·¨Âú×㣺
¢Ù¶ÔÈκεĶÔÏóx£¬¶¼ÓÐx.clone() !=x//¿Ë¡¶ÔÏóÓëÔ­¶ÔÏó²»ÊÇͬһ¸ö¶ÔÏó
¢Ú¶ÔÈκεĶÔÏóx£¬¶¼ÓÐx.clone().getClass()= =x.getClass()//¿Ë¡¶ÔÏóÓëÔ­¶ÔÏóµÄÀàÐÍÒ»Ñù
¢ÛÈç¹û¶ÔÏóxµÄequals()·½·¨¶¨ÒåÇ¡µ±£¬ÄÇôx.clone().equals(x)Ó¦¸Ã³ÉÁ¢¡£
 
¢ÆJavaÖжÔÏóµÄ¿Ë¡
¢ÙΪÁË»ñÈ¡¶ÔÏóµÄÒ»·Ý¿½±´£¬ÎÒÃÇ¿ÉÒÔÀûÓÃObjectÀàµÄclone()·½·¨¡£
¢ÚÔÚÅÉÉúÀàÖи²¸Ç»ùÀàµÄclone()·½·¨£¬²¢ÉùÃ÷Ϊpublic¡£
¢ÛÔÚÅÉÉúÀàµÄclone()·½·¨ÖУ¬µ÷ÓÃsuper.clone()¡£
¢ÜÔÚÅÉÉúÀàÖÐʵÏÖCloneable½Ó¿Ú¡£
 
Çë¿´ÈçÏ´úÂ룺
public class Student implements Cloneable
{
 int age;
 String name;
 Professor p;
 public Student(int age, String name, Professor p) {
  this.age = age;
  this.name = name;
  this.p = p;
 }
 public Object clone() {
  Student o = null;
  try {
   o = (Student) super.clone();//ObjectÖеÄclone()ʶ±ð³öÄãÒª¸´ÖƵÄÊÇÄÄÒ»¸ö¶ÔÏó¡£
  } catch (Exception e) {
   System.out.println(e.toString());
  }
  return o;
 }
 public static void main(String[] args) {
  Professor p = new Professor(40, "poul");
  Student stu1 = new Student(18, "pitt", p);
  Student stu2 = (Student)stu1.clone();
  stu2.p.name = "wang";//ÐÞ¸ÄѧÉú2ºó£¬²»Ó°ÏìѧÉú1µÄÖµ¡£
  stu2.p.age = 12;
  System.out.println("stu1.p.name=" + stu1.p.name
    + ",stu1.p.age=" + stu1.p.a


Ïà¹ØÎĵµ£º

javaʹÓÃJNIµ÷ÓÃC++º¯Êý

ÍøÉÏÓÐÁ˺ܶàÕâÑùµÄÎÄÕ£¬²»¹ý¸Ð¾õ²¢²»ÊǺÜÈ«£¬ÎÒ¶¼¶«ÕÒÎ÷ÕÒ²Å×îÖÕ°ÑJAVAµ÷ÓÃc++¸ø¸ã¶¨¡£
ÏÂÃæÒýÓÃÁ˺ܶàÍøÉÏÒѾ­ÓеĵÄÄÚÈÝ£¬ÎÒÔÚÕâÀïÖ»ÊÇÕûºÏÒ»´Î£¬ÈÃÒÔºóµÄÅóÓÑÉÙ×ßÍø·¡£
¶à˵ÎÞÒ棬¾ßÌåÈçÏ£º
×÷Õß:mykoma
¼ÙÉèËùÓÐÎļþ¶¼·ÅÔÚd:\
Step 1:
дJAVAÎļþ
ÀýÈç³ÌÐòtestdll.java£¬ÄÚÈÝΪ£º   
  ......

FILTER¹ýÂËJAVA WEBµÄ×Ö·û±àÂë

ÒÔǰΪÁ˹ýÂËJavaµÄISO-8859-1×Ö·û£¬×ÜÊÇʹÓÃÈçÏ´úÂëÀ´´¦Àí¡£
view plaincopy to clipboardprint?
String strUserame = (String)reuqest.getParameter("username");   
strUsername = new String(strUserame.getBytes("ISO-8859-1"),"UTF-8");  
String strUserame ......

ͨ¹ýJava hread dump·ÖÎöÕÒµ½ºÄ·ÑCPU×î¸ßµÄÔ´´úÂë

ͨ¹ýJava hread dump·ÖÎöÕÒµ½ºÄ·ÑCPU×î¸ßµÄÔ´´úÂë
×÷Õߣººú¼Ò»Ô 2010-04-11
×î½ü²úÆ·ÔÚÔËÐйý³ÌÖгöÏÖÁËÐÔÄÜÎÊÌ⣬Ôںܵ͵ÄÁ÷Á¿µÄÇé¿öÏÂCPU¾Í´ïµ½40%£¬Á÷Á¿ÉÔ¸ßʱCPU¾Í´ïµ½98%¡£
²úÆ·ÊÇJavaдµÄ£¬ÔËÐÐÓÚJBOSSƽ̨¡£²Ù×÷ϵͳΪredhat linux¡£µ±Äãͨ¹ýtopÃüÁî·¢ÏÖÄãµÄÓ¦ÓóÌÐòµÄ½ø³ÌÕ¼ÓÃCPU´ï98%ʱ£¬ÎÒÏëÄã¿Ï¶¨ÏëÖªµÀ¾¿¾¹Ê ......

javaÖÐÄÚ²¿ÀàµÄʹÓÃ

ÄÚ²¿ÀàµÄʹÓõÄÓÅȱµã£º
Óŵ㣺¼õÉÙÁËÔÚÀàÎļþ±àÒëºóµÄ²úÉúµÄ×Ö½ÚÂëÎļþµÄ´óС
ȱµã£ºÊ¹³ÌÐò½á¹¹²»ÇåÎú
ʹÓÃÄÚ²¿ÀàµÄ×¢ÒâÊÂÏ
ÄÚ²¿ÀàµÄʹÓÃÒ»°ã¶¼ÓëËùÔÚµÄÍⲿÀàÓÐÒ»¶¨µÄ¹ØÁª£¬ËüÊÇÔÚÒ»¸öÀàµÄÄÚ²¿Ç¶Ì׶¨ÒåµÄÀ࣬Ëü¿ÉÒÔÊÇÆäËüÀàµÄ³ÉÔ±£¬Ò²¿ÉÒÔÔÚÒ»¸öÓï¾ä¿éµÄÄÚ²¿¶¨Ò壬»¹¿ÉÒÔÔÚ±í´ïʽÄÚ²¿ÄäÃû¶¨Òå(ÄäÃûÄÚ²¿Àà)¡£
ÄÚ²¿ ......

final ÔÚjavaÖеÄ×¢Òâµã

×¢ÒâÊÂÏîÂýÂý»ýÀÛ
final À಻¿É±»¼Ì³Ð£¬Ò²²»ÄÜÓÐ×ÓÀà¡£
final class Book{}
//class ComBook extends Book{}     Õ⽫±àÒëʧ°Ü£¬ÒòΪBookÀ಻¿É±»¼Ì³Ð¡£
final·½·¨²»¿É±»¸Äд
class Book{
          final void show£¨£©{System.out.println("Book ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ