Gopala Krishnan

Greenhorn
+ Follow
since Mar 04, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gopala Krishnan

Guys page 248 of RHE, in the note it is said StringBuffer has equals method, which says will compare two encapsulated strings, but we know that equals always return false with StringBuffer. I just wanted to confirm with u guys.
thanks.
the following code:
1. public class aclass
2. {
3. public static void main(String[] args)
4. {
5. int i = 015;
6. int j = 032;
7. int k = 078;
8. System.out.println(i);
9. System.out.println(j);
10. System.out.println(k);
11. }
12. }
when compiled tells that "aclass.java:7:Invalid character in octal number.
int k = 078;"
here the mark points to the prefix zero.
what is the mistake here.
Thanks in advance
The following copied from poddar test.
1. StringBuffer sb1 = new StringBuffer("Amit");
2. StringBuffer sb2= new StringBuffer("Amit");
3. String ss1 = "Amit";
4. System.out.println(sb1==sb2);
5. System.out.println(sb1.equals(sb2));
6. System.out.println(sb1.equals(ss1));
7. System.out.println("Poddar".substring(3));
why line no.5 & 6 gives result false.
thanx in adv
guys every object makes it own copy of the instance variables and methods(excluding the static variables and methods), so one object cant access the copy of the instance variable of the other object, eventhough they are from same class.
==
hi ok
it is actually
if(2!=3)System.out.printl("not eq");
how is this prints. isn't the == check is only for object comparison.
==
How the following prints "hi".
if(2==3)System.out.println("hi");
what comparison is done here.