Hungson Le

Ranch Hand
+ Follow
since Jan 25, 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 Hungson Le

You should indicate that your function might throw an exception
using the throws clause

LHS
[This message has been edited by Hungson Le (edited March 16, 2001).]
Hi there,
I've been doing C++ and Java. I have several certifications in C++ and have just started thinking about getting certified in Java recently. Could someone please tell me what is the passing score? How many questions and how much time are there?
Thanks,
Tho
HI,
Both initialzer and constructor are used to initialize objects. Initializer gets called before the constructor within the same class. For annonymous class, we must use initializer since constructor is not available (since the annonymous class doesn't have a name).
LHS
Venkat,
Could you please give me a link to the IBM mock exam? I'd like to try them.
Thanks,
LHS
Answer is d. Return type is not part of the signature; therefore, the 2 functions can't be overloaded.
LHS
Hi,
Private methods are included in subclass, but not inherited. The reason they are included in subclass is because public methods may need them in order to work (public method in superclass might call privated methods -- usually private methods act like an aid to public ones). You can redeclare it, but it's not overriden.

LHS
Anshuman ,
You're right. I didn't pay attention to what you said
Please look at a similar hot topic:
"Can static methods be inherited?" - stater Judy Yu
You said "private methods are inherited", which is absolutely wrong.
Please look at the JLS from Sun, private methods are not inherited,
but included in the subclass.
If you trust the bartender here, Jane Griscti did say that


basically, as 'static' methods are not inherited


I totally agree with her.
This is the shot after my last shot =)
LHS
[This message has been edited by Hungson Le (edited February 02, 2001).]
Folks,
We need some expert to confirm what we've been discussing on this topic. Even though I'm coming from a C++ backgourng, I'm positive that overloading is not late binding. Usually late binding takes some extra overhead that slow down your program. I don't see any reason why would the compiler ever come to late binding when early binding for overloadding can happen at compile time.???
Any bartender out there, I need your word just to confirm what I say here.
Thanks,
LHS
p.s.
Krishna, you were right. In C, overloading is possible:
int add(int a, int b);
int add(double a, double b);

[This message has been edited by Hungson Le (edited February 02, 2001).]
Folks,
My last shot on this topic:


"Members of a class that are declared private are not inherited by subclasses of that class. Only members of a class that are declared protected or public are inherited by subclasses declared in a package other than the one in which the class is declared.
Constructors, static initializers, and instance initializers are not members and therefore are not inherited."


Excerpt from JLS (Java Language Specifications from SUN]
LHS

Venkat,
"Java determines particular overloaded method to be executed during run time by late binding."
I don't think so. Overloadded method can be specified at compile time. The reason is that at compiler time the compiler already knows what method to invoke. (by the diff. in method signatures -- There's no need to have an object-oriented language to provide you this feature. Procedural language does support this feature.)
LHS


[This message has been edited by Hungson Le (edited February 01, 2001).]
Anshuman,
I dont' know velumurugan. Please leave me a link.
Thanks,
Tho
Charlie,
Thanks for the info. It's very important for us to know if an exception is checked or unchecked.
LHS.
Kevin,
Polymorphism gotta go with late binding. In "Thinking in Java",
edition 1, page 321, Bruce Eckel says:


"People are confused by other, non-object-oriented features of Java, like method overloading, which are sometimes presented as object-oriented. Don't be fooled: If it isn't late binding, it isn't polymorphism"


Kelvin, I'm coming from a C++ background, I don't know if polymorphism still remains the same concept in Java, but in C++, polymorphism must be obtained trough late binding, inheritance, virtual funcions, and pointers/references.
Please verify.
Thanks,
Tho
Just to prove what Anshuman said:
You can re-declare a private method, but it has nothing to do with inheritance.

A.method() is included in B (hidden) for certain operations.
When you create an instance of class B, line //// shows that this hidden method had been called.
LHS
[This message has been edited by Hungson Le (edited February 01, 2001).]
Deepak,
My code works fine with JBuilder4. Please try it and let me know what you see.
Thanks,
LHS