Olly Ontario

Greenhorn
+ Follow
since Mar 17, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Olly Ontario

Probably I seem to be getting it now .
Thanks for the help



Rgds,
Olly
16 years ago
I'm sorry! still not able to understand.
If you say that overriding is working then the child's method should be called which has a String return type then why do I need an explicit cast?!

Rgds,
Olly
16 years ago
What I dont understand is why don't overriding rules apply here.
We are invoking a method on the child object with a parent reference then should'nt the method with the String return type be called as per the Java rules which by default enable overriding.

Regards,
olly
16 years ago
Hello

was trying to solve some java mock exam questions but I am unable to understand the following:



After reading the code I thought that the child method will be called because a parent reference is referring to a child object and also overriding will come into play so "Derived" should be printed out.
However the correct answer given is "Compilation error" because a call to o.method1() will return an Object which will not be compatible to String s unless it is cast.
Can someone explain why "derived" is not the output of the code?
Thanks
Olly
16 years ago
No they did not take my voucher nor did they scratch the silver foil off the vocher. They just made me fill a form and gave me a date and time. I still have the voucher with me.
Regarding giving the exam a day earlier... all the slots are full here.

Regards,
Olly
In fact I asked them for the date as I needed more time. They told me that last day vouchers give a problem sometimes.

Regards,
Olly
I have booked the slot on the last day, but the prometric centre didn't take my voucher. They just told me to be there at 8pm on 24th Jan 2009 with Identity proof and my sun java exam voucher. So I am not sure about the validity on that day yet?

Thanks,
Olly
Hello!

The expiry date on my SCJP 1.6 voucher is 24th Jan 2009, I have scheduled my exam at a Prometric test centre on 24th Jan 2009 at 8pm.
Is there a problem in giving the exam on the last day mentioned on the exam voucher, I consulted some of my friends and they say that that taking the exam on the last day mentioned on the voucher is risky and they have told me to avoid doing it.

Please let me know your views, I am from India.

Regards,
Olly
Thanks Anubhav,

The thing that has got be confused is the different paths of the file:

in Explorer I am getting the path of the file as D:\java\examsys\web\Q.txt
while the real path returned in the webapp is D:\java\examsys\build\web\Q.txt

Dont know how the build folder got included in the path and the app still works.

Rgds,
Olly
17 years ago
Hello!
Thanks for your clues!

I worked on them and found that using:

String strRelPath = request.getContextPath();

returns something like "\\examsys" so I had to concatenate it with + "\\web\\Q.txt"

to get the whole address "\\examsys\\web\\Q.txt"
But this did not work and I got a File not found exception.

Next I tried the

String strRealPath = getServletContext().getRealPath("");
this returned the actual path "D\\java\\examsys\\build\\web" and I just had to concatenate it with the file name + "Q.txt" and this worked.

But I still dont understand when I check in explorer the path of the file is "D\\java\\examsys\\web\\Q.txt"
but the real path while debugging returns as "D\\java\\examsys\\build\\web" and it still works.
I'm happy but still confused.
Any explanations?!

Rgds,
Olly
17 years ago
Hello there!

In a J2EE app I am reading a File using
FileReader fr = new FileReader("D:\\java\\examsys\\web\\Q.txt");

But this is the absolute path of the file.
Once I upload this app on the server the path will change.
I have tried all combinations for relative path like
"\\examsys\\web\\Q.txt"
"examsys\\web\\Q.txt"
".\\examsys\\web\\Q.txt"

it does not work
Is there a way out, Please...
This IDE is NetBeans with Tomcat included.

Rgds,
Olly
17 years ago
Awwww!
Opps!
Sorry! I wasnt using the trailing ;.
Thanks for all your help Marc & Rob.

Rgds,
Olly
17 years ago
Well!
I tried <applet code=Test.class age=33 width=100 height=100>

but it printed <applet code=Test.class age=33 width=100 height=100>

dont know why < does not work and > works?

PLease help

Olly
17 years ago
Thanks for the hint Marc.
I'm on it. Will let you know Asap.

Rgds,
Olly
17 years ago
Hi there!
I am trying to read the following line from a text file and print in on an HTML page in a J2EE app:

<applet code=Test.class age=33 width=100 height=100>

but I am not getting proper string output.
I want to print it as a string.
I have tried all possible escape sequences.
Is there any escape sequence for the ">" and "<" characters.

Please help.
Olly
17 years ago