Hi, This is from K&B mock exam.
Given answer is although String and StringBuffer are both subtypes of CharSequence, they are not necessarily
the same subtype as whatever is passed in (S)..I am not clear. Please let me know
Malte Wannerskog wrote:I have a question about this particular question aswell...
compiles and runs just fine without any compiler warnings for me. Am I missing something?
Same goes for
No compiler warnings there aswell. Even though this was not an option in my question.
Thanks for your help
Ah nevermind, I realized that the compiler error didnt occur until you actually try to use the method .
For example with
Joined: Feb 23, 2011
Hmm, now I think I am missing something:
This program compiles with warnings, but runs fine. This is part of the mock questions of the SCJP Java 6 Study Guide for 310-065 (Quiz #56). The given answer to the question is, that both return statements will not compile or they will not run without errors. But the compiler thinks different about that.