Java¼¸ÖÖ½¨Á¢ÊµÀýµÄ·½·¨
Java¼¸ÖÖ½¨Á¢ÊµÀýµÄ·½·¨
new
ÀûÓÃJava¹Ø¼ü×ÖnewÀ´½¨Á¢¶ÔÏóʵÀýÊÇJavaÖÐ×îΪ³£¼ûÒ²ÊÇ×îΪ¼òµ¥µÄ½¨Á¢¶ÔÏóʵÀýµÄ·½·¨¡£Èô³ÌÐòд³ÉÈçÏÂÐÎʽ£¬
Ôò¿É½¨Á¢somethingÀàµÄ¶ÔÏóʵÀýºóÔÙÖ¸¶¨µ½±äÁ¿obj¡£
something obj=new something();
´Ëʱ£¬±ØÐë°ÑÀàÃû(ÔÚ´ËΪsomething)дÔÚÔ´ÂëÖ®ÄÚ¡£
clone
ÈôÀûÓÃclone·½·¨£¬Ôò¿É¸ù¾ÝÏÖÓеĶÔÏóʵÀýÀ´½¨Á¢ÀïÒ»¸öжÔÏóʵÀý¡£ÀûÓÃclone·½·¨À´½¨Á¢¶ÔÏóʵÀýÖ»ÏÞÓÚʵÏÖ
ÁËjava.lang.Cloneable½Ó¿ÚµÄÀà¡£Èç¹ûûÓÐʵÏָýӿڣ¬Ôò»áÅ׳öCloneNotSupportedExceptionÒì³£¡£Èô³ÌÐò
д³ÉÈçÏ£¬Ôò¿É¸ù¾Ýµ±Ç°¶ÔÏó±¾Éí½¨Á¢ÁíÒ»¸ö¶ÔÏóʵÀý(µ«²¢Î´ÀûÓù¹Ôì·½·¨)¡£
class Something
{
//codes
public Something createClone()
{
Something obj=null;
try
{
obj=(Something)clone();
}
catch(CloneNotSupportedException e)
{
e.printStackTrack();
}
return obj;
}
}
newInstance
ÀûÓÃjava.lang.ClassÀàµÄnewInstance·½·¨£¬¿ÉÒÔ¸ù¾ÝClassµÄ¶ÔÏóʵÀý£¬½¨Á¢¸ÃClassËù±íʾµÄÀàµÄ¶ÔÏóʵ
Àý(µ÷ÓÃÎÞ²ÎÊýµÄ¹¹Ôì·½·¨)
ÏÂÃæÊÇSomethingÀàµÄ¶ÔÏóʵÀýsomeobj£¬Ôò¿ÉÒÔÓÃÏÂÃæµÄ±í´ïʽ½¨Á¢Ò»¸öSomethingÀàµÄ¶ÔÏóʵÀý¡£
someobj.getClass().newInstance();
//or next codes
Something obj=Class.forName(Something).newIntance();
ÖµµÃ×¢ÒâµÄÊÇ£¬newIinstance·½·¨»áÅܳöInstantiationException»òÕßIllegalAcsessExceptionÒì³££¬ËùÒÔ
Ó¦¸ÃÔÚcatchÓï¾ä¿éÖⶻñÕâ¸öÒì³£¡£
Ïà¹ØÎĵµ£º
java¶¨Ê±Æ÷µÄʹÓÃ
¶¨Ê±Æ÷ÀàTimerÔÚjava.util°üÖС£Ê¹ÓÃʱ£¬ÏÈʵÀý»¯£¬È»ºóʹÓÃʵÀýµÄschedule(TimerTask task, long delay)·½·¨£¬É趨ָ¶¨µÄÈÎÎñtaskÔÚÖ¸¶¨µÄÑÓ³ÙdelayºóÖ´ÐС£¶¨Ê±Æ÷ÈÎÎñÀàTimerTaskÊdzéÏóÀ࣬¼Ì³Ð²¢ÖØдÆärun()·½·¨£¬¿ÉʵÏÖ¾ßÌåÈÎÎñ¡£
schedule(TimerTask task, Date time)É趨ָ¶¨ÈÎÎñtaskÔÚÖ¸ ......
ÐÞ¸ÄJavaÎļþ²»ÓÃÖØÆôTomcat·þÎñµÄ·½·¨
ÔÚʹÓÃEclipse+Tomcat¿ª·¢JavaÏîÄ¿µÄʱºò³£³£»áÅöµ½ÕâÑùµÄÇé¿ö£¬ÒÑÐÞ¸ÄJavaÎļþTomcat¾Í»á×Ô¶¯ÖØÆô£¬½ÓÏÂÀ´¾ÍÊÇÂþ³¤µÄµÈ´ý·þÎñÖØÆôÍê±Ï¡£ÄÇÆäʵ´ó¶àÊýµÄJavaÎļþÐÞ¸ÄÊÇûÓбØÒªÖØÆô·þÎñµÄ£¬Ö»ÓÐһЩÌض¨µÄJavaÎļþ£¬±ÈÈç˵ֻÓÐÖØÆô·þÎñµÄʱºò²Å»áµ÷Ó ......
ÀàµÄ°ü·ÃÎÊȨÏÞ£º¡¶Java±à³Ì˼Ïë¡·ÖÐÒ»¶Î»°µÄÀ§»ó
ÔÚ¡¶java±à³Ì˼ÏëµÚÈý°æ¡·£¨³Âê»Åô ÈÄÈô骵ÈÒ룩µÄµÚÎåÕÂÒþ²Ø¾ßÌåʵÏÖÖУ¬5.4½ÚµÄ×îºóÒ»¶Î»°ÊÇ£º
“ÕýÈçÇ°ÃæËùÌáµ½µÄ£¬Èç¹ûûÄÜΪÀà·ÃÎÊȨÏÞÖ¸¶¨Ò»¸ö·ÃÎÊÐÞÊηû£¬Ëü¾Í»áȱʡµÃµ½°ü·ÃÎÊȨÏÞ¡£ÕâÒâζןÃÀàµÄ¶ÔÏó¿ÉÒÔÓÉ°üÄÚÈκÎÆäËûÀàÀ´´´½¨£ ......
public String getCheckDateString(String str) {
Date date = new Date();//»ñÈ¡µ±Ç°ÏµÍ³ÈÕÆÚ
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");//ʱ¼ä¸ñʽ
......
µÚ1Õ strutsÓëjava webÓ¦Óüò½é
1.1 java webÓ¦ÓøÅÊö
1.2 web×é¼þµÄÈýÖÖ¹ØÁª¹Øϵ
1.3 muv¸ÅÊö
1.4 struts¸ÅÊö
1.4.1 strutsʵÏÖmvcµÄ»úÖÆ
ÔÚstruts¿ò¼ÜÖУ¬Ä£ÐÍÓÉʵÏÖÒµÎñÂß¼µÄjavabean»òejb×é¼þ¹¹³É£¬¿ØÖÆÆ÷ÓÉ
ActionServletºÍActionÀàʵÏÖ£¬ÊÓͼÓÉÒ»×éjspÎļþ¹¹³É¡£
1.ÊÓͼ
ÊÓͼ¾ÍÊÇjspÎļþ¡£ÔÚÕâЩjspÎļþ ......