Changchun Wang

Ranch Hand
+ Follow
since Feb 15, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Changchun Wang

may be you can try this example


above is unreachable,but the below is ok

from that we can know the process that the complier handle the unreachable problems on method
I think the complier only sure the foo() method will excute well in main method ,but not check the statement in foo() method while ckecking the main method
[ July 06, 2006: Message edited by: Changchun Wang ]
thanks to all ranchers in this Forum,supplying very useful questions and free resources or answering my questions .
I dont have k&b book ,even had done a few free mock exams ,hence every day I must spend five hours on this forum ,and lasted for about three monthes
I am very glad to have joined this forum
about k&b book I think it was good book for preparing exam,although i do not buy it ,because it cost two months in delivering this book,I think very good questions suppying by others are from this book,hence if you want get higher scores ,you had to buy this book and do more commercial mock exams
18 years ago
if a class which having package declaration can not import default package's class or static members
hence you can not do that
a question about unreachable

also

who could explain it clearly
thanks
Assure the jvm do not throw an NosuchMethodError:
the main must public ,static,and have only String[] paramter
the following main method will not throws an exception
public static void main(String []a){}
public static void main(String...a){}
public static void main( final String...a){}
public static final void main(final String...a)
public static synchronized final void main(final String...a)
public static <T extends String>void main(String[] a)
public static <T extends String> void main(T[] a)
public static <T extends String> void main(T... a)
any comments on it?
also if you have others which do not throws an exception
plz put below
[ April 23, 2006: Message edited by: Changchun Wang ]
I do not know that you do not understand where
may be the difference between do {statement }while(exprssion )
and while(expression){statement}
in one word
if do{statement} while(exprssion) the expression is evaluated after the statement is executed. While the expression is true, the statement is executed repeatedly.
if while(exprssion ){statement } exprssion first and then statement executing

this is steps of this program executing
i j
10 5
9 6
8 7
7 8
after it while (j--<i++) will executed one time ,but the exprssion is false
hence do {}while() ends and now i=6;j=9
executed for (initialization-expression;loop-expression;update-expression)
statement
update-expression first hence i--, now i=5
then executed loop-exprssion i>5,hence loop-exprssion is false ,so for loops ends


if you change your code like this

you will get some different result
you can compare the code

notes the problem is no relation to conviant return types
and found the trouble on field and method
There are some questions about some code compiling without no warning and compie error.
so i want to know warning clearly
thanks you replies
Under what circumstances ,the compiler will generate unchecked warning?
I know assign a parameterized type to a raw type and will give warning
but List<? extends Comparale> will occur a warning?
Generally we use List<? extends Comparale<String>> or other
Covariant return types
the overriding method's return type is subtype of the overriden method's return type

Originally posted by M Mistroni:

i missed another one in doing some mock exams..

Question 6.

An Interface can never be private or protected.



i answered true, the exam says proper answer was false....

i got a feeling that exam is incorrect.... can anyone confirm?



An package level interface can only public or dafault
but a nested interface can have all the access modifiers
interface A
{
}
class Outer
{protected interface B{}
private interface C{}
}
the above code will compile ok
I think you should use br.close()
because from java api
I know if you invoke br.close()
fr will close bacause this method is inside br.close()
b is local final blank
and the blank final denoted the value of b determining in run time
so blank final is not constant exprssion

form jls3

so the final wrapper class is not constant exprssion
from jsl4


polymorphism, meaning that an object of a given class can have multiple forms, either as its own class or as any class it extends. The new class is a subclass or extended class of the class it extends; the class that is extended is its superclass.


hence i think polymorphism effect on object other than methods or others