mr. mukhlis, wah sekali browsing ketemu tuh : --- An int is a primitive. It is not an Object. An int is a high performance, streamlined beast for calculating numbers in the range -2,147,483,648 [-231] aka Integer.MIN_VALUE to +2,147,483,647 [2 31-1] aka Integer.MAX_VALUE. An int is a bare bones 32-bit chunk of information. int variables are mutable. Unless you mark them final, you can change their value at any time.
An Integer, is a Object that contains a single int field. An Integer is much bulkier than an int. It is sort like a Fedex box to contain the int. Integers are immutable. If you want to affect the value of a Integer variable, the only way is to create a new Integer object and discard the old one. ----- http://mindprod.com/jgloss/intvsinteger.html Pada 27 Oktober 2009 01:49, sm96 <syaiful.mukh...@gmail.com> menulis: > > > > hahahaha, ketipu dia rupanya. > > >>Nah, ada yang tau kenapa ? > > >>String a = "halo"; > >>String b = "halo"; > > >>atau > > >>String a = "halo"; > >>"halo" == a , hasilnya true > > >>a==b hasilnya bisa true. > > daripada bingung malah bikin pusing, ikuti saja sesuai cara yg benar. > Ini lagi contohnya yg bikin bingung, kalo gak ngerti bedanya : > > int a = 10; > int b = 10; > > a== b jelas true dong. > > tapi, > > Integer a = 10; > Integer b = 10; > > kok a==b true ya? > int sama Integer ini sebenarnya barangnya beda lho. > > tapi, ada satu lagi nih > Integer a = new Integer(10); > Integer b = new Integer(10); > > ternyata a==b, false.... > > kenapa hayo...? > > kalo tau ini penyebabnya kenapa, maka jawaban yg kamu dapat > sama jawabannya dengan pertanyaan diatas. > > >