Java ±à³ÌµÄ¶¯Ì¬ÐÔ£¬µÚ 8 ²¿·Ö: ÓôúÂëÉú³ÉÈ¡´ú·´Éä
´Ó±¾ÏµÁÐÇ°ÃæµÄÎÄÕÂÖУ¬ÄúÁ˽⵽·´ÉäµÄÐÔÄܱÈÖ±½Ó·ÃÎÊÒªÂýÐí¶à±¶£¬²¢Á˽âÁËÓà Javassist ºÍ Apache
Byte Code Engineering Library £¨BCEL£©½øÐÐclassworking¡£Java ¹ËÎÊ Dennis
Sosnoski ͨ¹ýÑÝʾÈçºÎʹÓÃÔËÐÐʱ classworking£¬À´ÓÃÈ«ËÙǰ½øµÄÉú³É´úÂëÈ¡´ú·´Éä´úÂ룬´Ó¶ø½áÊøËûµÄ Java ±à³ÌµÄ¶¯Ì¬ÐÔ
ϵÁС£
¼ÈÈ»ÄúÒѾ¿´µ½ÁËÈçºÎʹÓà Javassist ºÍ BCEL ¿ò¼ÜÀ´½øÐÐ classworking £¨Çë²ÎÔÄ
±¾ÏµÁÐÒÔǰµÄÒ»×éÎÄÕÂ
£©£¬
ÎÒ½«Õ¹Ê¾Ò»¸öʵ¼ÊµÄ classworking Ó¦ÓóÌÐò¡£Õâ¸öÓ¦ÓóÌÐòÓÃÔËÐÐʱÉú³ÉµÄ¡¢²¢Á¢¼´×°Ôص½ JVM µÄÀàÀ´È¡´ú·´Éä¡£ÔÚ×ÛºÏÌÖÂ۵Ĺý³ÌÖУ¬ÎÒ½«ÒýÓñ¾ÏµÁеÄǰÁ½ÆªÎÄÕ£¬ÒÔ¼°¶Ô
Javassist ºÍ BCEL µÄÌÖÂÛ£¬ÕâÑù±¾ÎľͳÉΪÁ˶ÔÕâ¸öºÜ³¤µÄϵÁÐÎÄÕµÄÒ»¸öºÜºÃµÄ×ܽᡣ
·´ÉäµÄÐÔÄÜ
ÔÚ
µÚ
2 ²¿·Ö
£¬
ÎÒչʾÁËÎÞÂÛÊǶÔÓÚ×ֶηÃÎÊ»¹ÊÇ·½·¨µ÷Ó㬷´Éä¶¼±ÈÖ±½Ó´úÂëÂýºÜ¶à±¶¡£ÕâÖÖÑÓ»º¶ÔÓÚÐí¶àÓ¦ÓóÌÐòÀ´Ëµ²»ËãÊÇÎÊÌ⣬µ«ÊÇ×ÜÊÇ»áÓöµ½ÐÔÄܷdz£¹Ø¼üµÄÇé¿ö¡£ÔÚÕâ
ÖÖÇé¿öÏ£¬·´Éä¿ÉÄܳÉÎªÕæÕýµÄÆ¿¾±¡£µ«ÊÇ£¬Óþ²Ì¬±àÒëµÄ´úÂëÈ¡´ú·´Éä¿ÉÄÜ»á·Ç³£»ìÂÒ£¬²¢ÇÒÔÚÓÐЩÇé¿öÏ£¨ÈçÔÚÕâÖÖ¿ò¼ÜÖУº·´Éä·ÃÎʵÄÀà»òÕßÏîÄ¿ÊÇÔÚÔËÐÐʱ
ÌṩµÄ£¬¶ø²»ÊÇ×÷ΪÕâÒ»±àÒë¹ý³ÌµÄÒ»²¿·ÖÌṩµÄ£©£¬Èç¹û²»ÖØÐ¹¹½¨Õû¸öÓ¦ÓóÌÐò¾Í¸ù±¾²»¿ÉÄÜÈ¡´ú¡£
Classworking ʹÎÒÃÇÓлú»á½«¾²Ì¬±àÒëµÄ´úÂëµÄÐÔÄÜÓë·´ÉäµÄÁé»îÐÔ½áºÏÆðÀ´¡£ÕâÀïµÄ»ù±¾·½·¨ÊÇ£¬ÔÚÔËÐÐʱ£¬ÒÔÒ»ÖÖ¿ÉÒÔ±»Ò»°ãÐÔ´úÂëʹÓõķ½Ê½£¬¹¹½¨Ò»¸ö×Ô¶¨ÒåµÄÀ࣬ÆäÖн«°ü×°¶ÔÄ¿±êÀàµÄ·ÃÎÊ£¨ÒÔǰÊÇͨ¹ý·´Éä´ïµ½µÄ£©¡£½«Õâ¸ö×Ô¶¨ÒåÀà×°ÔØµ½
JVM Öк󣬾ͿÉÒÔÈ«ËÙÔËÐÐÁË¡£
ÉèÖý׶Î
Çåµ¥ 1 ¸ø³öÁËÓ¦ÓóÌÐòµÄÆðµã¡£ÕâÀﶨÒåÁËÒ»¸ö¼òµ¥µÄ bean Àà
HolderBean
ºÍÒ»¸ö·ÃÎÊÀà
ReflectAccess
¡£·ÃÎÊÀàÓÐÒ»¸öÃüÁîÐвÎÊý£¬¸Ã²ÎÊý±ØÐëÊÇÒ»¸öֵΪ
int
µÄ bean ÀàÊôÐÔµÄÃû×Ö£¨
value1
»òÕß
value2
£©¡£ËüÔö¼ÓÖ¸¶¨ÊôÐÔµÄÖµ£¬È»ºóÔÚÍ˳öǰ´òÓ¡³öÕâÁ½¸öÊôÐÔÖµ¡£
Çåµ¥ 1. ·´ÉäÒ»¸ö bean
public class HolderBean
{
private int m_value1;
private int m_value2;
public int getValue1() {
return m_value1;
}
public void setValue1(int value) {
m_value1 = value;
}
public int getValue2() {
return m_value2;
}
public void
Ïà¹ØÎĵµ£º
JAVAÏà¹Ø»ù´¡ÖªÊ¶
1¡¢ÃæÏò¶ÔÏóµÄÌØÕ÷ÓÐÄÄЩ·½Ãæ
2¡¢StringÊÇ×î»ù±¾µÄÊý¾ÝÀàÐÍÂð?
3¡¢int ºÍ Integer ÓÐÊ²Ã´Çø±ð
4¡¢String ºÍStringBufferµÄÇø±ð
5¡¢ÔËÐÐʱÒì³£ÓëÒ»°ãÒì³£ÓкÎÒìͬ£¿
6¡¢Ëµ³öServletµÄÉúÃüÖÜÆÚ£¬²¢Ëµ³öServletºÍCGIµÄÇø±ð¡£
7¡¢Ëµ³öArrayList,Vector, LinkedListµÄ´æ´¢ÐÔÄܺÍÌØÐÔ
8¡¢EJBÊÇ»ùÓÚÄÄЩ ......
ÕâÁ½Ìì×ÜÊÇתÌû×ÓÁË£¬²»¹ý¿´¹ýºó£¬ÎÒÊÜÒæ·Ëdz£¡£¡
javaÖÐÖØÐ´ºÍÖØ¹¹¶þÕߵ͍ÒåºÍÇø±ð£¿
ÖØ¹¹¿É²»ÊÇ“ÖØÔØ¹¹Ô캯Êý”µÄ¼òд¡£
Èí¼þÖØ¹¹ºÍÖØÐ´Ñ¹¸ù²»ÊÇÒ»¸ö²ã´ÎÉϵĶ«Î÷£¡
Èí¼þÖØ¹¹ÊÇ˵³ÌÐòԱΪÁË¶Ô ÒÑÓгÌÐòÔÚ¾¡Á¿²»¸Ä±ä½Ó¿ÚµÄǰÌáÏ ½øÐÐÈçÏ´¦Àí ¶ø×öµÄ ÖØÐ±àд´úÂëµÄ¹¤×÷
1¡¢È¥³ýbug
2¡¢Ìá¸ßЧ ......
/**
* ¶ÑÅÅÐò
*
* */
public void heapSort(double[] a){
double temp;
initCreateHeap(a);
for(int i = a.length - 1; i > 0; i --){
temp = a[0];
a[0] = a[i];
a[i] = temp;
createHeap(a, i, 0);
}
}
/**
* ½«Êý×é¿´³ÉÍêÈ«¶þ²æÊ÷£¬½¨Á¢×î´ó¶Ñ
* */
private ......
Ò»¡¢final
¡¡¸ù¾Ý³ÌÐòÉÏÏÂÎÄ»·¾³£¬Java¹Ø¼ü×ÖfinalÓГÕâÊÇÎÞ·¨¸Ä±äµÄ”»òÕß“ÖÕ̬µÄ”º¬Ò壬Ëü¿ÉÒÔÐÞÊηdzéÏóÀà¡¢·Ç³éÏóÀà³ÉÔ±·½·¨ºÍ±äÁ¿¡£Äã¿ÉÄܳöÓÚÁ½ÖÖÀí½â¶øÐèÒª×èÖ¹¸Ä±ä£ºÉè¼Æ»òЧÂÊ¡£
finalÀ಻Äܱ»¼Ì³Ð£¬Ã»ÓÐ×ÓÀ࣬finalÀàÖеķ½·¨Ä¬ÈÏÊÇfinalµÄ¡£
final·½·¨²»Äܱ»×ÓÀàµÄ·½·¨¸²¸Ç£¬µ«¿ÉÒ ......
package com;
import java.util.*;
public class WhatDay {
public static void main(String[] args) {
Calendar c = Calendar.getInstance();
c.setTime(new Date(System.currentTimeMillis()));
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
switch (dayOfWeek) {
ca ......