Li Wenfeng

Greenhorn
+ Follow
since Aug 26, 2002
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 Li Wenfeng

I passed SCJP 1.2, but I heard that SCJP update test($100) is a requirement to take the SCJD exam? is that true or false?
thanks!
I passed SCJP 1.2, but I heard that SCJP update test($100) is a requirement to take the SCJD exam? is that true or false?
thanks!
2. Given:
Integer i = new Integer (42);
Long 1 = new Long (42);
Double d = new Double (42.0);
Which two expressions evaluate to True? (Choose Two)
A. (i ==1)
B. (i == d)
C. (d == 1)
D. (i.equals (d))
E. (d.equals (i))
F. (i.equals (42))
I was given the answer D,E. But both D and E result in "false", because english is not my native language, so maybe I misunderstanded the question sentence: "evaluate to True", does it mean "which two of the options could be compiled fine?" rather than "get result of "true""?
thanks!
I think the answer is a,b. In Option b, It may like this:
class Super{
Super(int i){}
}
class Base{
void createAnonymous(){
new Super(5){};
}
}
Am i right?
I'm sorry!
here it is!
which two are true?
A. An anonymous inner class can be declared inside of a method
B. An anonymous inner class constructor can take arguments in some situations
C. An anonymous inner class that is a direct subclass of Object can implements
multiple interface
D. Even if a class Super does not implement any interfaces, it is still possible
to define an anonymous inner class that is an immediate subclass of Super that
implements a single interface
E. Even if a class Super does not implement any interfaces, it is still possible
to define an anonymous inner class that is an immediate subclass of Super that
implements multipe interface
The following statement is gived as a correct answer in a question: "Even if a class Super does not implement any interfaces, it is still possible to define an anonymous inner class that is an immediate subclass of Super that implements a single interface." , but how to declare this kind of anonymous class that extends a super class and also implements a single interface? any help, thanks!
[ October 28, 2002: Message edited by: Li Wenfeng ]
here is an exception: ^_^
class Base{
private Base(){}
Base(String s){}
}
class Sub extends Base{
Sub(){
super("s");
}
}
//Okay
It's a very cool pattern description, thanks a lot,J2EE jini girl!
"Math constructor is private", I saw this statement from several docs, but I do not find Math constructor in JDK1.3.1 API doc.
Is this constructor provide by compiler and declared private accessibility?
Any suggest is appreciated!
thanks greatly for your warmhearted replies!
"Static methods can be overridden by static methods only.", is this statement correct or wrong? pls!
Sun SCJP training book said "You cann't override a static method and you can only hide it".
can somebody give me an explanation about static method overriden?
thanks!
given the following sample code:
class A{
int i=getJ();
int j=10;
int getJ(){return j;}
public static void main(String[] args){
A a = new A();
System.out.println("i="+a.i+" j="+a.j);
}
}
Why does it output that i is 0, rather than 10?
thanks!
[ September 22, 2002: Message edited by: Li Wenfeng ]
[ September 24, 2002: Message edited by: Li Wenfeng ]
Given the following code,what's the output?
class Meal {
Meal() { System.out.println("Meal()"); }
}
class Bread {
Bread() { System.out.println("Bread()"); }
}
class Cheese {
Cheese() { System.out.println("Cheese()"); }
}
class Lettuce {
Lettuce() { System.out.println("Lettuce()"); }
}
class Lunch extends Meal {
Lunch() { System.out.println("Lunch()");}
}
class PortableLunch extends Lunch {
PortableLunch() {
System.out.println("PortableLunch()");
}
}
class Sandwich extends PortableLunch {
Bread b = new Bread();
Cheese c = new Cheese();
Lettuce l = new Lettuce();
Sandwich() {
System.out.println("Sandwich()");
}
public static void main(String[] args) {
new Sandwich();
}
}
I think the output should be:
Breed()
Cheese()
Lettuce()
Meal()
Lunch()
PortableLunch()
Sandwich()
Actually, the result is:
Meal()
Lunch()
PortableLunch()
Breed()
Cheese()
Lettuce()
Sandwich()
Why are the three instance variables of Sandwich initialized between super() and the body of the constructor--Sandwich()??
thanks!!
hi,all
who are using Biran's scjp book: 《Sun Certified Programmer for Java 2 Study Guide,Second Edition(Exam:310-025)》? I found quite a lot of errors in his book? Anyway, he indeed give the details of conceptes for the picky SCJP2 exam. But he did not provide feedback forms, or errata page!
[ August 31, 2002: Message edited by: Li Wenfeng ]
It's a question about abstract class.


Given:
1. class A{
2. abstract int getNum();
3. }
And the following:
4.
5. public static int pi=3;
6. int getNum(){
7. return 5;
8. }
9. }
The second file can be compiled successfully by inserting a line of code on line 4. Which of the following lines will allow compilation to succeed? (Choose all that apply.)
A. class B extends A{
B. abstract class B extends A{
C. final abstract class B extends A{
D. final class B extends A{
E. abstract class B{


My answer is E, but Biran gives the answer of A,B,D,and E. If the keyword abstract was added in front of line 1, then I think his answer is right.
However,in the preceding question, class A will not be compiled at all! Biran made another mistake, so I will compile and run the sample questions about which I am not sure to really grasp every objective!
[ August 31, 2002: Message edited by: Li Wenfeng ]