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

¡¾×ª¡¿ÈçºÎÔÚJavaÖбÜÃâequals·½·¨µÄÒþ²ØÏÝÚå

ÒëÕß×¢ :Äã¿ÉÄÜ»á¾õµÃJavaºÜ¼òµ¥£¬ObjectµÄequalsʵÏÖÒ²»á·Ç³£¼òµ¥£¬µ«ÊÇÊÂʵ²¢²»ÊÇÄãÏëÏóµÄÕâÑù£¬ÄÍÐĵĶÁÍê±¾ÎÄ£¬Äã»á·¢ÏÖÄã¶ÔJavaÁ˽âµÄÊÇÈç´ËµÄÉÙ¡£Èç¹ûÕâƪÎÄÕÂÊÇÒ»·ÝJava³ÌÐòÔ±µÄÈëÖ°±ÊÊÔ£¬ÄÇô²»ÖªµÀÓжàÉÙÈË»áµôÂäµ½ÕâÑùµÄÏÝÚåÖС£Ô­ÎÄת×Ôhttp://www.artima.com/lejava/articles/equality.html Èýλ×÷Õ߶¼ÊDz»Í¬ÁìÓòµÄ´óÄã¬ÓÐÐËȤµÄ¶ÁÕß¿ÉÒÔ´ÓÉÏÃæÕâ¸öÁ¬½ÓÖ±½ÓÈ¥ÔĶÁÔ­ÎÄ¡£
ÕªÒª
±¾ÎÄÃèÊöÖØÔØequals·½·¨µÄ¼¼Êõ£¬ÕâÖÖ¼¼Êõ¼´Ê¹ÊǾßÏÖÀàµÄ×ÓÀàÔö¼ÓÁË×Ö¶ÎÒ²Äܱ£Ö¤equalÓïÒåµÄÕýÈ·ÐÔ¡£
ÔÚ¡¶Effective Java¡·µÄµÚ8ÏîÖУ¬Josh BlochÃèÊöÁ˵±¼Ì³ÐÀà×÷ΪÃæÏò¶ÔÏóÓïÑÔÖеĵȼ۹ØϵµÄ»ù´¡ÎÊÌ⣬Ҫ±£Ö¤ÅÉÉúÀàµÄequalÕýÈ·ÐÔÓïÒåËù»áÃæ¶ÔµÄÀ§ÄÑ¡£BlochÕâÑùдµ½£º
³ý·ÇÄãÍü¼ÇÁËÃæÏò¶ÔÏó³éÏóµÄºÃ´¦£¬·ñÔòÔÚµ±Äã¼Ì³ÐÒ»¸öÐÂÀà»òÔÚÀàÖÐÔö¼ÓÁËÒ»¸öÖµ×é¼þʱÄãÎÞ·¨Í¬Ê±±£Ö¤equalµÄÓïÒåÒÀÈ»ÕýÈ·
ÔÚ¡¶Programming in Scala¡·ÖеĵÚ28ÕÂÑÝʾÁËÒ»ÖÖ·½·¨£¬ÕâÖÖ·½·¨ÔÊÐí¼´Ê¹¼Ì³ÐÁËÐÂÀ࣬Ôö¼ÓÁËеÄÖµ×é¼þ£¬equalµÄÓïÒåÈÔÈ»Äܵõ½±£Ö¤¡£ËäÈ»ÔÚÕâ±¾ÊéÖÐÕâÏî¼¼ÊõÊÇÔÚʹÓÃScalaÀà»·¾³ÖУ¬µ«ÊÇÕâÏî¼¼ÊõͬÑù¿ÉÒÔÓ¦ÓÃÓÚJava¶¨ÒåµÄÀàÖС£ÔÚ±¾ÎÄÖеÄÃèÊöÀ´×ÔÓÚProgramming in ScalaÖеÄÎÄ×ÖÃèÊö£¬µ«ÊÇ´úÂë±»ÎÒ´Óscala·­Òë³ÉÁËJava
³£¼ûµÄµÈ¼Û·½·¨ÏÝÚå
java.lang.Object ÀඨÒåÁËequalsÕâ¸ö·½·¨£¬ËüµÄ×ÓÀà¿ÉÒÔͨ¹ýÖØÔØÀ´¸²¸ÇËü¡£²»ÐÒµÄÊÇ£¬ÔÚÃæÏò¶ÔÏóÖÐд³öÕýÈ·µÄequals·½·¨ÊǷdz£À§Äѵġ£ÊÂʵÉÏ£¬ÔÚÑо¿ÁË´óÁ¿µÄJava´úÂëºó£¬2007 paperµÄ×÷ÕߵóöÁËÈçϵÄÒ»¸ö½áÂÛ£º
¼¸ºõËùÓеÄequals·½·¨µÄʵÏÖ¶¼ÊÇ´íÎóµÄ£¡
Õâ¸öÎÊÌâÊÇÒòΪµÈ¼ÛÊǺͺܶàÆäËûµÄÊÂÎïÏà¹ØÁª¡£ÀýÈçÆäÖÐÖ®Ò»£¬Ò»¸öµÄÀàÐÍCµÄ´íÎóµÈ¼Û·½·¨¿ÉÄÜÒâζ×ÅÄãÎÞ·¨½«Õâ¸öÀàÐÍCµÄ¶ÔÏó¿ÉÐÅÀµµÄ·ÅÈëµ½ÈÝÆ÷ÖС£±ÈÈç˵£¬ÄãÓÐÁ½¸öÔªËØelem1ºÍelem2ËûÃǶ¼ÊÇÀàÐÍCµÄ¶ÔÏ󣬲¢ÇÒËûÃÇÊÇÏàµÈ£¬¼´elem1.equals(elm2)·µ»Øture¡£µ«ÊÇ£¬Ö»ÒªÕâ¸öequals·½·¨ÊÇ´íÎóµÄʵÏÖ£¬ÄÇôÄã¾ÍÓпÉÄܻῴ¼ûÈçϵÄһЩÐÐΪ£º
Set hashSet = new java.util.HashSet();
hashSet.add(elem1);
hashSet.contains(elem2); // returns false!
µ±equalsÖØÔØʱ£¬ÕâÀïÓÐ4¸ö»áÒý·¢equalsÐÐΪ²»Ò»Öµij£¼ûÏÝÚ壺
¶¨ÒåÁË´íÎóµÄequals·½·¨Ç©Ãû(signature) Defining equals with the wrong signature.
ÖØÔØÁËequalsµÄµ«Ã»ÓÐͬʱÖØÔØhashCodeµÄ·½·¨¡£ Changing equals without also changing hashCode.
½¨Á¢ÔÚ»á±ä»¯×ÖÓòÉϵÄequals¶¨Òå¡£ Defining equals


Ïà¹ØÎĵµ£º

javaµ÷ÓÃoracle´æ´¢¹ý³Ì

Ò»£ºÎÞ·µ»ØÖµµÄ´æ´¢¹ý³Ì
´æ´¢¹ý³ÌΪ£º
create or replace procedure adddept(deptno number,dname varchar2,loc varchar2)
as
  begin
    insert into dept values(deptno,dname,loc);
end;
È»ºóÄØ£¬ÔÚjavaÀïµ÷ÓÃʱ¾ÍÓÃÏÂÃæµÄ´úÂ룺
public class TestProcedure {
 Connectio ......

Java IO ²Ù×÷Óë×Ö½ÚÁ÷

FileÀà
Ò»¸öFileÀàµÄ¶ÔÏ󣬱íʾÁË´ÅÅÌÉϵÄÎļþ»òĿ¼¡£
FileÀàÌṩÁËÓëƽ̨Î޹صķ½·¨À´¶Ô´ÅÅÌÉϵÄÎļþ»òĿ¼½øÐвÙ×÷
Á÷ʽI/O
Á÷(Stream)ÊÇ×Ö½ÚµÄÔ´»òÄ¿µÄ¡£
Á½ÖÖ»ù±¾µÄÁ÷ÊÇ£ºÊäÈëÁ÷(Input Stream)ºÍÊä³öÁ÷(Output Stream)¡£¿É´ÓÖжÁ³öһϵÁÐ×ֽڵĶÔÏó³ÆΪÊäÈëÁ÷¡£¶øÄÜÏòÆäÖÐдÈëһϵÁÐ×ֽڵĶÔÏó³ÆΪÊä³öÁ÷¡£
Á÷µ ......

ÔÚJavaÖе÷ÓÃC++

ÔÚjavaÖе÷ÓÃ×Ô¼ºµÄc++´úÂëÊÇÒ»¼þ¼òµ¥µÄÊÂÇ飬ÒÔÏÂÀàΪÀý£º
class Prompt {
  private native String getLine(String prompt);
  public static void main(String args[]) {
    Prompt p = new Prompt();
    String input = p.getLine("Type a line: ");
  &nbs ......

wikiϵͳ£¨JAVA£© ¹Û²ì


×î½üÏë¶ÔÓÚwikiϵͳµÄÔ´´úÂëÑо¿ÏÂ
 
jspwikiÊÇÒ»¸ö²»´íµÄwikiÒýÇ棬´¿jsp/servletдµÄ¡£JSPWiki²»Ê¹ÓÃÏֳɵÄÊý¾Ý¿â¹ÜÀíÈí¼þ£¬ËùÓеÄÎļþÒÔÎı¾ÎļþµÄÐÎʽ´æ·Å¡£ËüÀûÓÃÀàËÆCVSµÄ»úÖƱ£Ö¤ÁËÎļþ°æ±¾µÄÍêÕûÐÔ¡£Ö§³ÖÖÐÎÄ£¬Ö§³Ö°æ±¾±È½Ï¡¢È¨ÏÞ¹ÜÀíµÈ¹¦ÄÜ£¡
ÏîÄ¿Ö÷Ò³£º http://www.jspwiki.org/
ÎĵµµØÖ·£º  ......

ʹÓÃԭ֭ԭζµÄJava ÓïÑÔ

±¾ÎÄÕª×Ô£º http://www.ibm.com/developerworks/cn/java/j-noaccent.html
ѧϰһÖÖеıà³ÌÓïÑÔ±ÈѧϰеĿÚÍ·ÓïÑÔÒªÈÝÒ׵öࡣȻ¶ø£¬ÔÚÕâÁ½ÖÖѧϰ¹ý³ÌÖУ¬¶¼Òª¸¶³ö¶îÍâµÄŬÁ¦È¥Ñ§Ï°²»´ø¿ÚÒôµØ˵ÐÂÓïÑÔ¡£Èç¹ûÄúÊìϤ C »ò C++£¬ÄÇôѧϰ Java ÓïÑÔ²¢²»À§ÄÑ£¬Õâ¾ÍÏñÊÇ»á˵ÈðµäÓïµÄÈËȥѧµ¤ÂóÓïÒ»Ñù¡£ÓïÑÔËäÓв»Í¬£¬µ«Óֱ˴˻ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ