Shankar G

Greenhorn
+ Follow
since Sep 24, 2000
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 Shankar G

Hi Sunitha, Where did you find the answers to these questions? Is it available there itself?
Break statement would try to break out of the enclosing loop while continue statement would try to continue the enclosing loop with the next loop-variable value -- if your intention is to continue the loop, use continue <label> instead.
Hope this helps.
- Shankar.
Well, I was referring non-String types but as for String, u r right.. Thanks for pointing out
[This message has been edited by Shankar G (edited September 24, 2000).]
Yes Paul, Registration works fine now
Here am now a registered user
That's precisely my question -- is it using "new" internally? If not, why isn't it using the same copy since the String would be one & the same.
Why does (a.toString() == a.toString()) return false?
Can't it make use of the same String object (ie, the same memory location) -- since it's the string representation of the same object, a -- and thereby result in the above expression to be true?
Paul, Can you please clarify further on the below posting from Mapraputa, so that I would be clear about the policy when I register.
- Shankar.



Mapraputa Is
ranch hand
<posted September 23, 2000 09:26 AM>

Gongratulations, Anonymous!
And a questuion to moderators:
now we all are recomended (for not to say more) to use our REAL names. When one
of us gave possible reasons for not to do it, s/he was referred as "horribly paranoid".
So I wonder, what are VALID reasons for not to reveal someone identity? Could
moderators give us a hint?
I cannot make up any good reason for hiddin your name, if you got such wonderful
scores. I think that's why many people did not trust Anonymous after his/her first
message.
I even agree to be called "horribly curious" - it is true. Who else can survive this
exam preparation...
And Gongratulations, Gongratulations, Gongratulations again!

Paul Wheaton
sheriff
posted September 23, 2000 09:41 AM

Mapraputa,
Please direct your questions about JavaRanch stuff to the JavaRanch forum. I'd kinda
like to keep all of this sort of discussion in one place.

22 years ago
This question has been already asked & answered, within in the past week -- plz. refer to the previous questions.
In other words, u should provide implementation for all the super-class' abstract methods in the sub-class, unless u want the sub-class also be of abstract type.
-- Shankar.
I agree -- as per JLS "Every interface is implicitly abstract", which means it cannot be instantiated with the new keyword. Refer to the section http://java.sun.com/docs/books/jls/html/9.doc.html#30820 of JLS.
Any comments?
- Shankar.

Originally posted by robl:
Which of the following statements are true?
1) An interface can only contain method and not variables
2) Java does not allow the creation of a reference to an interface with the new keyword.
3) A class may extend only one other class and implement only one interface
4) Interfaces are the Java approach to addressing the single inheritance model, but require implementing classes to create the functionality of the Interfaces.
The answer did not include number 2, but I thought that an interface could not be instantiated.
Please explain why the new keyword can be used with an interface.


Just give it a try -- u'll find that main can be both overloaded & overriden.
- Shankar.

Originally posted by Karthik Subramanian:

I would like to contradict with you Deepak regarding the point
that main method being overriden.I don't think they can be overriden in a file there can be only one correctly formed
main method.
Any remarks ??


I think it should be "final" -- can somebody confirm?

Originally posted by yanish:
22. If you want subclasses to access, but not to override a superclass member method, what keyword should precede the name of the superclass method? (Fill in blank).
I wrote: [b]super
but the MindQ says it's wrong.
Was I wrong?[/B]


The above given code would not give ClassCastException when the Super class & Sub class are directly related -- The below statements from the Java API should clear your doubt:
"Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance. For example, the following code generates a ClassCastException:

Object x = new Integer(0);
System.out.println((String)x);
"


Originally posted by Baskaran Subramani:
I too have the same doubt as Krishna. I expected a class cast exception at runtime in
q = (Q2)t;
Since t is of type parent, how come it is not giving class cast exception at runtime?


Yes, you are right -- the Button with the Label("Frown") would be eligible for GC. But the question was referring to the object referred by C.
-- Shankar.

Originally posted by Vasanth Appaji:
What about the object that was referenced by c1 earlier before c1 was assigned c. Since the since object does not have any reference, it must be eligible for GC right???