El Zhang

+ Follow
since May 13, 2003
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by El Zhang

Your class gave me compile error:
EPractice$1$5.java:13: getObject() in SubClass cannot override getObject() in EP
ractice$1$5; attempting to use incompatible return type
found : B
required: A
public B getObject(){return new B();}
1 error
After change the return type to A, and add two override functions
class A
int x=5;
public void foo(){
System.out.println("A foo");

class B extends A
int x=6;
public void foo(){
System.out.println("B foo");

class SubClass extends EPractice$1$5
public A getObject(){return new B();}

public class EPractice$1$5
public A getObject(){return new A();}
public static void main(String[] args)
EPractice$1$5 e=new SubClass();
A a = new B();
B b = new B();

And here is the output
java EPractice$1$5
B foo
so I guess for method override, it will call the real object instance's method, but for instance variable, it's different story.
If you choose B, then do you really think the find method has a name find?
My understanding here is that the ejbFind(), ejbHome() actually stands for ejbFindXXX() and ejbHomeXXX().

Originally posted by Roger Chung-Wee:
Can I make a suggestion ... check out the java.util.zip API doc and see which package is used for reading and writing.

"An enterprise bean must not use the java.io package to attempt to access files and directories in the file system."
Here I think the spec emphasize on file system not the java.io package. For example, it's ok to use the java.net.Socket in EJB where definitely we can use the java.io.InputStream and java.io.OutputStream.
And java.util.zip API is based on java.io.In/OutputStream, so my understanding is it's Ok to use java.util.zip package in EJB.
Did I miss sth here? Please correct me.
Raymond, congrat!
19 years ago
Thank you all, Marcus and Brian. I found many mock exams are actually more difficult (tricky) than the real test.
I am pleased to know this kind of questions will not come up in the real exam.
Thanks again
in jsp file
<% int i=0; %>
here i will be a local varible of the service method of generated servlet, correct?
My first guess is wrong, because actually i will be a local variable of the _jspService method which will be called by the service method.
I am confused because the answer is not what I expected. Any help? thanks in advance
Alex, just like abstract, native indicates the body of a method is somewhere else (in a library), where as abstract indicates the method implementation can be found in a subclass.
you can't put the curly braces there, so in the 3rd method declaration, there are two errors:
1.Transient applies only to variable declarations.
2.Native methods can't have a body
Hope this helps