ashok devaram

Greenhorn
+ Follow
since Oct 25, 2005
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 ashok devaram

Thank you very much kakkad.I got the point!
hai mahi,
i am extreamly sorry,my explanation seems to be wrong buddy.
This time i have some other explanation which is as follows:-

My explanation applies when u have like this: (IntegerValue<<NegativeInt)

just add 32 to the NegativeIntValue. (integers have 32 bit length..)
then u wil get new shift distance which may or may not be positive.
if u still get negative distance ,agin perform the addition on the new shift distance.Perform the above step until u get positive distance.


Example:-

2<<-10

add:- -10+32 = 22;

now 2<<22 = 2 * 2 power 22= 8388608 (which is "somethingelse" as u said).

hope this is write........ashok( emantav anna!)
hai mahi,kkkad and all

String s1=new String("ashok");//1
String s2="reddy"//2

how many string objects are created at line 1?
how many string objects are created at line 2?
if created where they r created?
I have a doubt on the number of string objects created in the following code. I got this from Kathy's programmer cert book.
The question is how many string objects are created in the following code

String s1 = "spring";
String s2 = s1 + "summer";
s1.concat("fall");
s2.concat(s1);
s1 += "winter";
System.out.println(s1 + " " + s2);

plz i need some detailed explanation!

thanks in advance
u did not override the equals() of objest class ,so default behaviour of equals method is as follows:-


"The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true)."

in ur code a and b are two different objects,so a==b results in false.
class Test
{
public static void main(String args[])
{
Byte b1=new Byte("127");
if(b1.toString()==b1.toString())
System.out.println("true");
else
System.out.println("false");
}
}
when attempt to run this code ,the output shown is "false"
can u clarify me why it is printing "false".