???????????????7#????== ???.equals

??????Java?У?????????????????????????????????==??????????????????ж???????.equals?????????????(int?? flosat?? char ??)????????????????????==?????????????????

int x = 4;
int y = 5;
if (x == y) System.out.println ("Hi");
// This ’if’ test won’t compile. if (x.equals (y)) System.out.println ("Hi");

?????????????Щ??==?????????????????????????????????equals????????????????????顣

?????????????????java.lang.Object ??????????equals????????????==???????ж????????????????????????

?????????????????equals????????????Щ??????String??????equals???????????String????????????????????????Integer??equals???????????????int????????

?????????????????????????????????????????equals?????????????????????????????????==????????

???????????????8#?????????????????????

????Java???????д32λ???????С????????????????????????????????????????????????????????д?????????????μ???????????(thread safe)???

public class Example{
private int value;
// More code here...
public void set (int x){
// NOTE: No synchronized keyword this.value = x;
}
}

?????????????????????д????????????????????

public void increment (){
// This is effectively two or three instructions:
// 1) Read current setting of ’value’.
// 2) Increment that setting.
// 3) Write the new setting back.
++this.value;
}

?????????????????????????????????????????????й???????????????????????Σ?????Щ?????????Щ?????????????????????????????????е????????????????????????????????????????????????????????????????

public synchronized void increment (){ ?? ++this.value; }

???????????????9#????catch ?????????????

?????????catch???????????????????????????

OutputStream os = null; try{
os = new OutputStream ();
// Do something with os here. ?? os.close();
}
catch (Exception e){
if (os != null) ?? os.close();
}