java¼¯ºÏÖжÔÏóÅÅÐò
¸ÅÊö£º±¾Ê¾ÀýʵÏÖ¶ÔÏó°´ÄêÁäÉýÐò ÈËÆøÉýÐòÅÅÐò¹¦ÄÜ ÐÕÃûÉýÐò ½µÐòÅÅÐò¹¦ÄÜ
package ch02;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* @author YaoShiyou ʵÏÖ¶ÔÏóÅÅÐò
*
*/
public class Person {
// ÐÕÃû
private String name;
// ÄêÁä
private int age;
// ÈËÆø
private int hobby;
public Person(String name) {
this.name = name;
}
public Person(String name, int age) {
this(name);
this.age = age;
}
public Person(String name, int age, int hobby) {
this(name, age);
this.hobby = hobby;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getHobby() {
return hobby;
}
public void setHobby(int hobby) {
this.hobby = hobby;
}
public static void main(String[] args) {
List<Person> list = new ArrayList<Person>();
list.add(new Person("g1", 18, 122));
list.add(new Person("g2", 17, 244));
list.add(new Person("g3", 45, 243));
list.add(new Person("g4", 9, 67));
list.add(new Person("g5", 98, 2));
System.out.println("ÅÅÐòǰ---");
for (Person person : list) {
System.out.println(person.getName() + "\t" + person.getAge() + "\t"
+ person.getHobby());
}
// Collectionsµ÷ÓÃsort ·½·¨ ²ÎÊýΪ
Collections.sort(list, new AgeComparatorAsc());
System.out.println("ÄêÁäÅÅÐòºó----");
for (Person person : list) {
Ïà¹ØÎĵµ£º
ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1 List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ ......
Ôڳɹ¦ÊµÏÖJavaµ÷ÓÃC++Ö®ºó£¬½ÓÏÂÀ´Ïëµ½ÄÜ·ñͨ¹ýJNAʵÏÖJavaµ÷ÓÃFortran£¬½ñÌìÊÔÑéÁËһϣ¬»¹ÊDZȽÏÈÝÒ׵ġ£
ÍøÉÏÓÐÒ»¸öJavaµ÷ÓÃF95µÄÀý×Ó£¬µ«ÊÇÎÒ¿¼ÂDz»½öҪʵÏÖF95µÄµ÷Ó㬻¹ÒªÊµÏÖF77µÄµ÷Óã¬ËùÒÔ·ÑÁËһЩÖÜÕÛ¡£
ÎÊÌâµÄ¹Ø¼üÔÚÓÚF77Ϊ¹ý³ÌÃû×Ô¶¯Ìí¼ÓÁËÒ»¸öβ²¿µÄÏ»®Ïߣ¬ËùÒÔsub1Õâ¸ö¹ý³Ì£¬µ½JavaÒ»¶Ë£¬¾Í±ä³ÉÁËsub1_£¬ ......
¡¾Ò»¡¿»ùÓÚ×Ö½ÚµÄÊäÈëÁ÷
ÖµµÃ×¢ÒâµÄµØ·½ÓУº
¢ÙLevel 2µÄÊäÈëÁ÷£¬´ó¶àÊý¶¼»áÖ¸Ã÷Êý¾ÝÔ´µÄÐÎʽ£ºÀýÈçByteArray£¬File£¬Piped
¢ÚLevel 3µÄÊäÈëÁ÷£¬Ôò²»»á³öÏÖ¾ßÌåµÄÊý¾ÝÔ´Ãû×Ö£¬¶øÊÇÒÔ¹¦ÄÜÈ¡´ú£ºÀýÈçBuffered£¬LineNumber
ËùÒÔ˵Level 3µÄÊäÈëÁ÷ÊǶÔLevel 2ÊäÈëÁ÷µÄ“·â×°ºÍ¹ýÂË”¡£Êµ¼ÊÉÏLevel 2µÄÊäÈëÁ÷£¬¶¼¼ ......
ÓÐÊÂÇ飬ÓÐЩÊÂÇéÊÇÁ¦²»´ÓÐÄ£¡À´±±¾©ÒѾÁ½¸ö¶àÔ¹ýÈ¥ÁË£¬×Ô¼ºÀë¿ªÖØÇ죬À뿪¿ªËýÁ½¸öÔÂÁË£¬À´Õâ¶ùµÄËùÓзÑÓö¼ÊÇËý¾Êֵģ¬ËýµÄ¸¸Ä¸²»ÖªµÀ£¬Îҵĸ¸Ä¸Ò²²»
ÖªµÀÎÒÏÖÔÚûÓÐÉϰ࣬¸ü²»ÓÃ˵ÎÒ²»ÔÚÉϰàÁË£¡Ã¿½»´òµç»°£¬¶¼¸ø¼ÒÀïÃæµÄÈËÈö»Ñ£¬ÐÄÀïÕæµÄÓÐʱºòÓÐÒ»Öֿ޵ijåµÄ¸Ð¾õ£¬ÐÄÀïÎØÆü£¬È´Ö»ÄÜÊǶÌÔݵ ......
ΪÁËʵÏÖ×Ô¶¨ÒåµÄlogÀ࣬Äܹ»Êä³ö¾ßÌåµÄ´úÂëÐÐÐкţ¬Í¨¹ýʹÓÃStackTraceElement¶ÔÏóʵÏÖÁË¡£
ÕâÀïÖ¸³öÐèҪעÒâµÄ¼¸¸öÎÊÌ⣺
1. ³ÌÐòÖзµ»ØµÄ´úÂëÐÐÐкţ¬ÊÇн¨StackTrackElement¶ÔÏóµÄÄÇÒ»ÐС£
2. ¿ÉÒÔͨ¹ý´«²ÎµÄ·½·¨ÊµÏÖÊä³öÌØ¶¨ÐÐÐкš£¾ßÌåʵÏÖ¼û´úÂë¡£
1/**
2 *
3 */
4package leo.demo ......