java£ºObject¶ÔÏó½øÐÐÅÅÐò
package arrays.compara;
import java.util.Arrays;
public class Student {
public static void main(String[] args) {
Stu[] stus = new Stu[]{
new Stu(156,34,"ad"),
new Stu(153,24,"cc"),
new Stu(126,37,"ab"),
new Stu(176,45,"as"),
new Stu(156,34,"bd")
};
Arrays.sort(stus);
for (int i = 0; i < stus.length; i++) {
System.out.println(stus[i].toString());
}
}
}
class Stu implements Comparable<Object> {
int hight;
int age;
String name;
public Stu(int hight, int age, String name) {
this.hight = hight;
this.age = age;
this.name = name;
}
//ÄêÁä±È½Ï
/*public int compareTo(Object obj) {
return (this.age > ((Stu)obj).age) ? 1 : (this.age == ((Stu)obj).age) ? 0 : -1;
}*/
//Éí¸ß±È½Ï
/*public int compareTo(Object obj) {
return (this.hight > ((Stu)obj).hight) ? 1 : (this.hight == ((Stu)obj).hight) ? 0 : -1;
}*/
//ÐÕÃû±È½Ï
public int compareTo(Object obj) {
return this.name.compareTo(((Stu)obj).name);
}
//ÖØдtoString()·½·¨
@Override
public String toString() {
return this.hight+"-->"+this.age+"-->"+this.name;
}
}
Ïà¹ØÎĵµ£º
ʹÓÃÀ༯²»½ö¿ÉÒÔ±íʾ³öÒ»¶ÔÒ»µÄ¹Øϵ£¬Ò²¿ÉÒÔ±íʾ³ö¶à¶Ô¶àµÄ¹Øϵ¡£ÀýÈ磬һ¸öѧÉú¿ÉÒÔÑ¡¶àÃſγ̣¬Ò»Ãſγ̿ÉÒÔÓжà¸öѧÉú²Î¼Ó£¬ÄÇôÕâ¾ÍÊÇÒ»¸öµäÐ͵Ķà¶Ô¶à¹Øϵ¡£
ÒªÍê³É±¾³ÌÐò£¬Ê×ÏÈÓ¦¸Ã¶¨ÒåÁ½¸öÀࣺѧÉúÐÅÏ¢ÀàStudent¡¢¿Î³ÌÐÅÏ¢ÀàCourse¡£ÔÚÒ»¸öѧÉúÀàÖдæÔÚÒ»¸ö¼¯ºÏ£¬±£´æÈ«²¿µÄ¿Î³Ì£»¶øÔڿγÌÀàÖ ......
ÉùÃ÷×Ö¶ÎÓ³Éä
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface FiledRef
{
String fieldName();
}
ÉùÃ÷±íÓ³Éä
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface TableRef
{
& ......
¹«Ë¾Óõ½´®¿Ú±à³Ì£¬¹Ê¿ªÊ¼Ñо¿£¬Ê×ÏÈËѵ½µÄÊÇjavacomm20-win32.zipÕâ¸öѹËõ°ü£¬°´ÕÕÍøÉϵݲװÅäÖúã¬ÈçÏ£º
API
ÔÚjavax.commÏÂÓÐ13¸öÀàºÍ½Ó¿Ú£¬·Ö±ðÊÇ
4¸ö½Ó¿Ú
CommDriver ¿É¸ºÔØÉ豸£¨the loadable device£©Çý¶¯³ ......
µ±Á½¸ö½ø³ÌÔÚ½øÐÐÔ¶³ÌͨÐÅʱ£¬±Ë´Ë¿ÉÒÔ·¢Ë͸÷ÖÖÀàÐ͵ÄÊý¾Ý¡£ÎÞÂÛÊǺÎÖÖÀàÐ͵ÄÊý¾Ý£¬¶¼»áÒÔ¶þ½øÖÆÐòÁеÄÐÎʽÔÚÍøÂçÉÏ´«ËÍ¡£·¢ËÍ·½ÐèÒª°ÑÕâ¸öJava¶ÔÏóת»»Îª×Ö½ÚÐòÁУ¬²ÅÄÜÔÚÍøÂçÉÏ´«ËÍ£»½ÓÊÕ·½ÔòÐèÒª°Ñ×Ö½ÚÐòÁÐÔÙ»Ö¸´ÎªJava¶ÔÏó¡£
¡¡¡¡°ÑJava¶ÔÏóת»»Îª×Ö½ÚÐòÁеĹý³Ì³ÆΪ¶ÔÏóµÄÐòÁл¯¡£
¡¡¡¡°Ñ×Ö½ÚÐòÁлָ´ÎªJava¶ÔÏóµÄ¹ ......
ÔÚjava¶ÔoracleµÄ²Ù×÷ÖУ¬ÈÕÆÚ×Ö¶ÎÊǺÜÍ·ÌÛµÄÊÂÇ飬Æäʵ×ÐϸÑо¿Ò»ÏÂÒ²²¢²»ÄÑÕÆÎÕ¡£
¾Ù¸öÀý×ÓÀ´ËµÃ÷£º
±í book ÖÐÓÐname varchar2(20)//Êé¼®Ãû³Æ,buydate Date //¹ºÂòÈÕÆÚ Á½¸ö×ֶΡ£
ÒѾ´´½¨ÁËÊý¾Ý¿âÁ¬½ÓConnection conn;
·½·¨Ò»¡¢Ê¹ÓÃjava.sql.DateʵÏֱȽϼòµ¥µÄyyyy-mm-dd¸ñʽÈÕÆÚ¡£
java.sql. ......