Praveena khandavalli

Greenhorn
+ Follow
since Jan 05, 2002
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 Praveena khandavalli

hi all,
first of all... thanx to all the ranchers for their help. I passed SCJP2 today(saturday).
i am a silent learner here ..and this site helped me a lot...
again thanx a lot..
regards
Praveena
20 years ago
hi all ,
here is the prog and its output is
Prints "Objects have different values";
can anybody explain why is it so...if i run the class by creating String objects rather than the MyClass object ..the result is 'equal'..i am confused please explain..thanx in advance
Praveena
--------------------------------------
1: class MyClass
2: {
3: static int maxElements;
4:
5: MyClass(int maxElements)
6: {
7: this.maxElements = maxElements;
8: }
9:
10: }
11:
12: public class Q19
13: {
14: public static void main(String[] args)
15: {
16:
17: MyClass a = new MyClass(100);
18: MyClass b = new MyClass(100);
19:
20: if(a.equals(b))
21: System.out.println("Objects have the same values");
22: else
23: System.out.println("Objects have different values");
24: }
25: }
------------------------------------------
hi corey,
nice explanation..very clear with the concept now.. thanx
Praveena
thanx a lot i got it
hi rob,
i tried to compile the code and the error was at line 6: where the long get(int a) is declared saying that the method cant override the method in class A and for that it needs the same return type. so when a method is redeclared in a subclass as in this case... compiler looks for the same method name in the superclass whether it exists or not and if exists first checks the argument list and the return type and so the overriding or overloading of themethod is done.Am i right ...correct me if i am wrong please
-Praveena

Originally posted by Rob Ross:
Merely changing the return type of a method is not enough to overload it. To overload a method, it must have a different signature. The signature is the list of types in the argument list.
These would be overloaded foo methods:
void foo(int i);
void foo(int i, double d);
int foo(String s);
But these are not:
int foo(int i);
void foo(int i);

Rob
[ January 28, 2002: Message edited by: Rob Ross ]

yes rob is right...do a search yu can find lot of information
[ January 28, 2002: Message edited by: Praveena khandavalli ]
hi basha,
in the case of signed right shift (>>
for example x>>y...then x is right -shifted by y bits...and this will be equivalent to x being divided by 2 raised by the value of 'y'. this works fine and is understandable in the case x being positive. if x were to be a negative number and when it is represented in binary form the left most bit represents the signature and in this case it is '1'...so when it is a negative number and is shifted by 'y' number of bits ..the negative sign is carried on..adn so the resulting number is negative ..this condition holds good until the number 'y' being less than 32.
hope yu understand the concept( as such i am trying put everything what ever i understood about this operator..please correct me if i am wrong)..
regards
Praveena

Originally posted by basha khan:
anyone plz tell me about >> operator and its dealings with negative numbers.
what is happening/output when u try to shift
3>>2 and
-3>>2
just the solution and explenaion will be much enough for me.

hi bill,
can yu explain me why do yu get a compiler error at line 1 as yu ahve mentioned. i am confused..please explain.. correct me if i am wrong.. here the method seems to be overloaded... so why do yu get the error..
after a long time i am back to my preparation ...now i have to do it wihtout any breaks .please help me in that
thanx in advance

Originally posted by bill williams:
1. in case you might not know this:
class A{
int get(int i){return 1;}
}
class B extends A{
long get(int i){return 1;}//line 1
}
compiler error on line 1. i got 3 questions on this concept
2. remember that anonymous class can have argument like this:
addListener(new xxxListener(5){....};
3. remember how and why constructor is not inhereted
hope it helps
bill


yes vikram yu are right...that search helps me alot. and now i search first and then post ..
follow that sonir it will help ..and stop feeling that ..a doubt is a doubt even though it is small or big all the best
regards
Praveena
can anyone explain correct answer for this question?
Which of the following statements about finalize methods are incorrect?
[Check all correct answers]
A) The purpose of a finalize method is to recover memory and other system resources.
B) The purpose of a finalize method is to recover system resources other than memory.
C) You should always write a finalize method for every class.
D) The order in which objects are created controls the order in which their finalize methods are called.
hi,
thats a good idea. i am planning to take the test before 30th of Jan.we can discuss and exchage programs
regards
Praveena
hi madhav and rob,
so the sign of the number being shifted by bits depends on the number by which it is shifted ...as you have mentioned unsigned right shift by '32' wont change the sign of the negative number ..
so the unsigned right shift on a negative number is not always positive
so the answer is false
got it
thanx
thanx rob and madhav.
its not at all related to the super class method...so we can declare a method with the same access modifier (in this case private) in the subclass.thanx a lot
True or False?
Unsigned Right Shift on a Negative Integer always returns a Positive Integer.
the answer is given as false?
i am confused as unsigned right shift on a number is always positive.
please explain..
regards
Praveena
then can we say private methods can be redeclared ??