Click here to Skip to main content

Java

   

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page  Show 
  Refresh
AnswerRe: Compress with java decompress with c# Pinmemberjschell12:42 24 Feb '12  
QuestionAndroid & Magnetic sensor. Pinmembergumigyuri22:53 21 Feb '12  
AnswerRe: Android & Magnetic sensor. PinmemberTorstenH.6:23 22 Feb '12  
QuestionPlease Help me PinmemberMohammed Kherfan9:36 21 Feb '12  
AnswerRe: Please Help me PinmemberTorstenH.19:36 21 Feb '12  
AnswerRe: Please Help me Pinmemberkid sister18:43 24 Feb '12  
QuestionA stupid question? [modified] Pinmembersharkbc2:09 17 Feb '12  
Hi all,
Near one or two years (version Java at that time is 1.5x), I have a short code to compare 2 Strings in java like bellow:
 
String a = "abc";
String b ="abc";//this is load from the database.
CODE 1
if(a==b){
    System.out.println("equal");
}else {
    System.out.println("dif");
}
 
and I got the result is dif
 
I remember because after I change the code to
 
String a = "abc";
String b ="abc";//this is load from the database.
CODE 2
if(a.equals(b)){
    System.out.println("equal");
}else {
    System.out.println("dif");
}
 
It give me the result is equal
 
Is it true or my eyes is wrong?
 
Now the CODE 1 always gives the result is equal

modified 17 Feb '12.

AnswerRe: A stupid question? PinPopularmemberBobJanova3:02 17 Feb '12  
AnswerRe: A stupid question? PinmemberTorstenH.3:11 17 Feb '12  
AnswerRe: A stupid question? Pinmemberjschell7:23 17 Feb '12  
GeneralRe: A stupid question? Pinmembersharkbc15:44 17 Feb '12  
GeneralRe: A stupid question? PinmemberTorstenH.19:57 19 Feb '12  
GeneralRe: A stupid question? Pinmemberjschell10:27 20 Feb '12  
AnswerRe: A stupid question? PinmemberNagy Vilmos0:45 21 Feb '12  
QuestionRegarding video compression in java Pinmemberadvarun22:39 15 Feb '12  
AnswerRe: Regarding video compression in java PinmemberNagy Vilmos23:41 15 Feb '12  
QuestionJava project Energy Consumption Calculator for data centers (Need Help) PinmemberKashifn4719:54 15 Feb '12  
AnswerRe: Java project Energy Consumption Calculator for data centers (Need Help) PinmvpRichard MacCutchan22:33 15 Feb '12  
AnswerRe: Java project Energy Consumption Calculator for data centers (Need Help) PinmemberTorstenH.4:07 16 Feb '12  
GeneralMessage Automatically Removed Pinmemberajinkyachavan8917:13 15 Feb '12  
QuestionMessage Automatically Removed Pinmemberajinkyachavan8917:12 15 Feb '12  
QuestionMessage Automatically Removed Pinmemberajinkyachavan8917:09 15 Feb '12  
Questionjava code for image segmentation Pinmembersajan_manohari21:50 14 Feb '12  
AnswerRe: java code for image segmentation PinmemberNagy Vilmos22:08 14 Feb '12  
AnswerRe: java code for image segmentation PinmemberBobJanova1:35 15 Feb '12  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Beta | 2.5.120517.1 | Last Updated 22 May 2012
Copyright © CodeProject, 1999-2012
All Rights Reserved. Terms of Use
Layout: fixed | fluid