java·¶ÐÍѧϰ
javaµÄ·¶ÐÍ»úÖÆ¿´ÆðÀ´ÓеãÏñC++µÄÄ£°æ£¬µ«Ïà±È½ÏC++µÄÄ£°æÀ࣬javaÖеķ¶ÐÍûÓйؼü×Ötemplate£¬²¢ÇÒÓÐ×Ų»Í¬µÄʵÏÖ»úÖÆ£¨±¾ÖÊÇø±ð£©¡£
·¶ÐÍÀà
ÏÈ¿´Ò»¸ö·¶ÐÍÀàµÄÀý×Ó£º
public class Demo1<T> {
private T value;
public Demo1(T value) {
this.value= value;
}
public void setFirst(T value){this.value= value;}
public T getFirst(){return value;}
}
ÀàÐͱäÁ¿T£¬ÓÃ<>À¨Æð£¬·ÅÔÚÀàÃûµÄºóÃæ¡£µ±ÎÒÃÇÐèÒªÕâ¸öÀàÊÇ£¬Ö»ÐèÒªÈç϶¨Ò壺
String string = "yangsq";
Demo1<String> demo1 = new Demo1<String>(string);
ÕâÑùÉùÃ÷µÄÒ»¸öDemo1ÀàÏ൱ÓÚ°ÑÉÏÃæ¶¨ÒåµÄDemo1ÀàÖÐT¶¼»»×÷StringÁË¡£
·¶ÐÍÀà¿ÉÒÔÓжà¸öÀàÐÍ£¬ÀýÈçÏñÉÏÃæµÄDemo1À࣬ÎÒÃÇ¿ÉÒÔ¸Ä×÷ÈçÏ£º
public class Demo2<T,U> {
private T tValue;
private U uValue;
public Demo2(T tValue, U uValue) {
this.tValue= tValue;
this.uValue = uValue;
}
... ...
}
2. ·¶ÐÍ·½·¨
Èç¹ûÎÒÃDz»ÐèÒª·¶ÐÍÀ࣬Ҳ¿ÉÒÔÖ»¶¨ÒåÎÒÃÇÐèÒªµÄ·¶ÐÍ·½·¨¡£·¶ÐÍ·½·¨¿ÉÒÔÔÚÆÕͨÀàÀﶨÒå¡£
public class Demo3 {
public <T> T getMiddle(T[] array) {
return array[array.length/2];
}
}
ÕâÀïÐèҪעÒâµÄÊÇÀàÐÍÐÞÊηûºÅ£¨ºìÌå±ê³öµÄ<T>£©£¬ËüÒª·ÅÔÚpublic£¨static/final£©ºóºÍ·µ»ØÀàÐÍǰ¡£ÔÚÎÒÃÇÐèҪʹÓÃÕâ¸ö·½·¨Ê±£¬¿ÉÒÔÈçϵ÷Óãº
Demo3 demo3 = new Demo3();
String[] strings = {"abc", "def", "wxy"};
String middle = demo3.<String>getMiddle(strings);
ʵ¼ÊÉÏ£¬ºìÌå±ê³öµÄ<String>ÍêÈ«¿ÉÒÔÊ¡ÂÔ¡£ÒòΪ¿ÉÒÔ¸ù¾ÝstringsµÄString[]ÀàÐÍÍÆ³ö¡£
ÎÒÃÇ»¹¿ÉÒÔ¶Ô·¶ÐͼÓÒÔÔ¼Êø£¬ÀýÈçÎÒÃÇ¿ÉÄÜÏ£ÍûTµÄÀàÐÍÄÜÓ¦ÓÃcomparaTo·½·¨£¬¼´Tµ
Ïà¹ØÎĵµ£º
keytoolÉú³ÉÖ¤Êé
ÑéÖ¤ÊÇ·ñÒÑ´´½¨¹ýͬÃûµÄÖ¤Êé
keytool -list -v -alias tomcat -keystore "%JAVA_HOME%/JRE/LIB/SECURITY/CACERTS" -storepass changeit
ɾ³ýÒÑ´´½¨µÄÖ¤Êé
keytool -delete -alias tomcat -keystore "%JAVA_HOME%/JRE/LIB/SECURITY/CACERTS" -storepass changeit
´´½¨Ö¤Êé
1.·þÎñ ......
ÎÒÃÇÔÚjspÒ³ÃæÉϵÄjs½Å±¾ÖпÉÒÔµ÷ÑÐjava´úÂ룬±ÈÈ磬ÎÒÃÇÐèÒªÔÙjsÖÐÓÃalertº¯ÊýÏÔʾ·þÎñÆ÷¶Ë·¢Ë͹ýÀ´µÄij¸ö×Ö·û´®ÄÇôÎÒÃÇ¿ÉÒÔÕâÑù×ö
tomcat주
ÔÚ·þÎñÆ÷¶ËÎÒÃÇÓÐrequest.setAttribute("name","abc");
ÄÇôÎÒÒªÔÚÒ³ÃæÉÏÓÃalertÏÔʾµÄ»°£¬ÓÐÁ½ÖÖ·½Ê½£º
1¡¢Ê¹ÓÃEL±í´ïʽ
ÔÚEl±í´ïʽµÄÍâÃæÓÃÒýºÅ¼´¿É£º
<scri ......
¹Ø¼ü×Ö: javaÖÐjxlµ¼³öÊý¾Ýµ½excelµÄÀý×Ó
ÒªÍùxlsÎļþÀïÃæÐ´ÈëÊý¾ÝµÄʱºòÐèҪעÒâµÄÊǵÚһҪн¨Ò»¸öxlsÎļþ
OutputStream os=new FileOutputStream("c:\\excel2.xls" );
ÔÙ½¨ÍêÕâ¸öÎļþµÄʱºòÔÙ½¨Á¢¹¤×÷Îļþ
jxl.write.WritableWorkbook wwb = Workbook.createWorkbook(new File(os));
Èç¹ûÕâ¸öÎļþÒѾ´æÔÚ,ÄÇà ......
δÍê³É ´ýÍêÉÆ
public class MagicCube {
/**
* Áù¸öÃæµÄϱêÖµ
* ¡õ5
* ¡õ¡õ¡õ¡õ 1234 ÕâËĸöÁ¬ÌåÕý·½ÐÎÏòºó˳ʱÕë°üΧ ÐγÉͲ״ È»ºó °Ñ5ºÍ6¿ÛÉÏ ¾ÍÐγÉÕý·½Ìå
* ¡õ6
*/
public static void main(String[] args) {
MagicCube mb = new MagicCube();
int i = 0;
for (Face f : mb.faces ......
1.½Ó¿ÚµÄ¶¨Ò壺
interface ½Ó¿ÚÃû
{ ½Ó¿ÚÌ壻 }
×¢Ò⣺½Ó¿ÚÌåÖÐÖ»Äܰüº¬³£Á¿¶¨ÒåºÍ·½·¨¶¨ÒåÁ ......