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

java ±È½ÏÆ÷µÄʹÓÃ

¶ÔÓÚÒ»¸öʵÏÖÁËComparable½Ó¿ÚµÄ¶ÔÏ󣬸ýӿÚÖ»ÄÜʵÏÖÒ»´Î¡£Èç¹ûÔÚÒ»¸ö¼¯ºÏÀïÃæÐèҪʹÓÃidÅÅÐò£¬¶øÔÚÁíÍâÒ»¸ö¼¯ºÏÀïÐèÒª°´Ãû×ÖÅÅÐòÕâʱ¾ÍÐèÒªÔÚÕâ¸ö¼¯ºÏÀïÃæÖ¸¶¨±È½ÏÆ÷¡£
Comparable½Ó¿ÚÉùÃ÷ÁËcompareTo(Object o)·½·¨
Comparator ½Ó¿ÚÉùÃ÷ÁËcompare(Object o1,Object o2)·½·¨
eg:
µÚÒ»¸öÊ÷¼¯ÊÇ°´ÕÕ¶ÔÏóĬÈϵÄidÅÅÐò£¬µÚ¶þ¸öÊ÷¼¯ÓÉÖ¸¶¨µÄ¹¹ÔìÆ÷°´ÕÕname ÅÅÐò
public class Employee implements Comparable<Employee>{
 
 private int id;
 
 private String name;
 
 public Employee(int id, String name){
  this.id = id;
  this.name = name;
 }
 
 public boolean equals(Object o){
  if (o == null ){
   return false;
  }
  
  if (this == o){
   return true;
  }
  
  if(!(o instanceof Employee)){
   return false;
  }
  
  Employee employee = (Employee)o;
  return (this.id == employee.id) && (this.name.equals(employee.name));
 }
 
 public int hashCode(){
  int result = 17;
  result = 37 * result + id;
  result = 37 * result + name.hashCode();
  return result;
 }
 
 public String toString(){
  return "id:"+id+",name:"+name+"";
 }
 
 public int compareTo(Employee employee){
  //ÉýÐò
  return this.id - employee.id;
  //½µÐò
  //return  employee.id - this.id;
 }
 public String getName() {
  return name;
 }
}
/*******************************************************************/
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Comparator;
public class TreeSetTest {
 public static void main(String []args){
  //ʹÓõÄÊÇʵÏÖÁËCompable ½Ó¿Ú¶ÔÏóĬÈϵÄÅÅÐò·½Ê½£¬°´idÉýÐòÅÅÐò
  SortedSet<Employee> treeSet = new TreeSet&


Ïà¹ØÎĵµ£º

Java±à³ÌÄÇЩʶùϵÁÐÎÄÕÂ(È«¼¯)


Java±à³ÌÄÇЩʶù1——ÐòÑÔ
Java±à³ÌÄÇЩʶù2——³ÌÐòÉè¼ÆÊÇʲô£¿
Java±à³ÌÄÇЩʶù3——ÄãÊʺÏѧϰ³ÌÐòÉè¼ÆÂð£¿
Java±à³ÌÄÇЩʶù4——ÈçºÎѧºÃ³ÌÐòÉè¼Æ£¿
Java±à³ÌÄÇЩʶù5——³ÌÐòÉè¼Æ½éÉÜС½á
Java±à³ÌÄÇЩʶù6——¼ÆËã»úÈí¼þ»ù±¾¸ÅÄî
Java±à ......

ÔÚOracleÏ¿ª·¢Java³ÌÐòµÄ¾­µäÎÊÌâ½â´ð

 
ÎÊÌâÒ»£ºÈç±£¼ÓÔØJDBCÇý¶¯³ÌÐò£º
 
Õý³£ÎÒÃǼÓÔØÇý¶¯³ÌÐòÓÐÈý¸ö;¾¶£º
 
1.Class.forName(String)ÕâÏëµ±ÓÚclassLoaderÒ»¸öStringÖ¸¶¨µÄÀ࣬ÔÚ×°ÔØʱ°Ñ¸ÃÇý¶¯³ÌÐòµÄ¾²Ì¬ÄÚÈݶ¼³õʼ»¯£¬ÆäʵÕâʱÇý¶¯³ÌÐòÀàµ÷ÓÃÁËDriverManager.registerDriver(driver)·½·¨¡£
 
2.ʹÓÃϵͳÊôÐÔ£ºSystem.getPro ......

JavaÁ¬½ÓmysqlÊý¾Ý¿â

Ê×ÏÈ£¬´ò¿ªMySQL Query Browser£¬ÔÚµ±Ç°TestÊý¾Ý¿âÏ£¬Ð½¨Ò»¸östudent±í£¬ÓÐÈçÏÂÊôÐÔ£º
create table student (name varchar(10),id int(2),sex varchar(10));
 
³ÌÐò¼ûÏ£º
package com.JDBC;
import java.sql.*;
public class JDBCTest {
public static void main(String[] args) {String driver = "com.mys ......

Java,JavaScript,JScript Çø±ð

ÕâÈý¸öÓïÑÔ·Ö±ðÊÇÈý¸ö¹«Ë¾¿ª·¢µÄ£¬SUNµÄJava£¬NetscapeµÄJavaScript£¬MicrosoftµÄJScript
JavaScriptÊÇÓÉNetscape¹«Ë¾¿ª·¢²¢ËæNavigatorµ¼º½ÕßÒ»Æð·¢²¼µÄ¡¢½éÓÚJavaÓëHTMLÖ®¼ä¡¢»ùÓÚ¶ÔÏóʼþÇý¶¯µÄ±à³ÌÓïÑÔ£¬²»ÐèÒªJava±àÒëÆ÷£¬¶øÊÇÖ±½ÓÔËÐÐÔÚWebä¯ÀÀÆ÷ÖУ¬ËüµÄÇ°ÉíÊÇLive Script¡£
JScriptÊÇÒ»ÖÖÀàËÆJavaScriptµÄÓïÑÔ¡ ......

JAVA¶¯Ì¬µ÷ÓÃWeb Services

·þÎñ¶ËµÄwebservicesµÄ·¢²¼ÊÇ»ùÓÚjax-ws¹æ·¶·¢²¼µÄ¡£ÏÂÃæÊÇ¿Í»§¶Ë¶¯Ì¬µ÷ÓõĴúÂ룬µ÷ÓõÄweb·þÎñÊÇ¿ÉÅäÖõġ£
1£ºÔÚxmlÎĵµÀïÅäÖÃwebservicesµÄwsdlµØÖ·£¬¶Ë¿ÚÃûºÍ²Ù×÷Ãû
2£ºÌṩһ¸ö·½·¨¶ÁÈ¡xmlÎĵµ£¬·µ»ØÒ»¸öList
     List list= ReadAndWriteXML.getWebServiceWsdlList();
   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ