Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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;
 }
 
}


Ïà¹ØÎĵµ£º

JAVA ¶à¶Ô¶àÀý×Ó

    ʹÓÃÀ༯²»½ö¿ÉÒÔ±íʾ³öÒ»¶ÔÒ»µÄ¹ØÏµ£¬Ò²¿ÉÒÔ±íʾ³ö¶à¶Ô¶àµÄ¹ØÏµ¡£ÀýÈ磬һ¸öѧÉú¿ÉÒÔÑ¡¶àÃſγ̣¬Ò»Ãſγ̿ÉÒÔÓжà¸öѧÉú²Î¼Ó£¬ÄÇôÕâ¾ÍÊÇÒ»¸öµäÐ͵Ķà¶Ô¶à¹ØÏµ¡£
ÒªÍê³É±¾³ÌÐò£¬Ê×ÏÈÓ¦¸Ã¶¨ÒåÁ½¸öÀࣺѧÉúÐÅÏ¢ÀàStudent¡¢¿Î³ÌÐÅÏ¢ÀàCourse¡£ÔÚÒ»¸öѧÉúÀàÖдæÔÚÒ»¸ö¼¯ºÏ£¬±£´æÈ«²¿µÄ¿Î³Ì£»¶øÔڿγÌÀàÖ ......

´«ÖDz¥¿ÍJAVAÅàѵOAÏîÄ¿ ÉóÅúÁ÷תģ¿é¶þ


´«ÖDz¥¿ÍJAVAÅàѵOAÏîÄ¿ ÉóÅúÁ÷תģ¿é¶þ
ËäÈ»ÕâÁ½ÌìѧϰµÄ֪ʶµãÊÇspring£¬µ«ÊÇÎҵĹ۵ã¾ÍÊÇѧһ¸ö֪ʶµã¾ÍҪѧͨ°É£¬ÒòΪÈç¹ûÇ°ÃæµÄ֪ʶ¶¼Ã»ÓÐѧ»á£¬ÓÖ¼±×ÅȥѧϰÐµĶ«Î÷£¬Ö»»áÇ·ÏÂÔ½À´Ô½¶àµÄ¶«Î÷£¡ÕâÒ²ÊÇÎÒѧϰµÄÖ÷ÕÅ¡£ËµÊµÔڵģ¬ÉÏÒ»¸öÏîÄ¿OAÏîÄ¿µÄ¶¼Ã»ÓÐÀí½âµÃ͸³¹£¬¾Í¼±×Åȥѧ£¬Ö»»áÔ½À´Ô½´óµÄѹÁ¦£¬Ô½À´Ô½Ã» ......

Java³õѧÕߣºÍ¼Êé¹ÜÀíС¹¤¾ß´úÂë

1.Welcome.java
import java.util.Date;
import java.util.Scanner;

public class Welcome {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args){
// TODO Auto-generated method stub

System.out.println("Welcome to vis ......

java£ºdoubleÀàÐͽØÈ¡Á©Î»Ð¡Êý£¬²»È¡Éᣬ

public class Split{
 public static void main(String[] args){
       double pai = 3.14159;
        findTwo(pai);
  public static void findTwo(double value){
    System.out.println(new DecimalFormat("0.##"). ......

java£º¶þ·Ö²éÕÒ·¨

package arrays.compara;
/**
 *
 * @author Happy ¶þ·Ö²éÕÒ·¨
 */
public class BinarySearch {
 public static void main(String[] args) {
  int[] arrInt = { 2, 34, 32, 24, 23, 34, 12, 3, 4, 2 };
  int index = bSearch(29, arrInt, 0, arrInt.length);
 & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ