yesterday(April 5th 2012) i'am trying comparing string which is in environment:
computer 1
- Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11D50b)
- OS X 10.7.3
computer 2
- Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11D50b)
- Window 7
computer 3
- Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11D50b)
- Linux Ubuntu 11.10
This is the code i'am trying
public class TComp{
public static void main(String[] args){
String a = "arif";
String b = "arif";
if(a==b){
System.out.println("match!");
}
}
}
As far as i know, to compare string in java we should using .equal() function and '==' will do interning in this case. But with those all computer with different OS, why intern work fine in computer 1, while i got error in computer 2 and computer 3?
please correct if any kind of word i've wrong. thank you.