Ritesh Raman

Ranch Hand
+ Follow
since Jun 20, 2005
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 Ritesh Raman

Hi Rob,

Can you please explain more below line (The annotation itself is inherited).how can Annotation methods are inherited ?
How can we use '@inherited'.if possible please explain with example:

!--Annotation methods are not inherited this way. [b]The annotation itself is inherited, and you can retrieve it using reflection. For example:

i have used the below line in our code , it give NullPointerException at the line no. 3. Pease explain:

1.Class<?> cls = ta.getClass();
2.TestAnnotation anno = cls.getAnnotation(TestAnnotation.class);
3.System.out.println(anno.doSomething()); --![/b]

Thanks
Ritesh
12 years ago
I am using following code to use Inherited Annotaion:


------TestAnnotation.java----------------------------------------------
import java.lang.annotation.Inherited;

@Inherited
public @interface TestAnnotation {
boolean isInherited() default true;
String doSomething() default "Do what?";
}

---------------------------------------------------------------------------
---------AnnotationChild.java------------------------------------------

@TestAnnotation
public class AnnotationChild {

public static void main(String [] args){

AnnotationChild ta = new AnnotationChild();
System.out.println("hello"+ta.doSomething());
}
}
--------------------------------------------------------------------------------
now i am getting compile time error.
The method doSomething() is undefined for the type AnnotationChild

i am not able to use the interface properties.
please guide where i m wrong.

Thanks
Ritesh
12 years ago
HI

I am happy to tell you guys that I got certified as a SCWCD 5.0 with 94% score yesterday (on Wednesday 25th March,2009.)
I would like to thank HFSJ authors for excelllent book and all the ranchers for sharing usefull information.

I lost my score in Session Management & Design Patterns.Really HFSJ book (1st and 2nd edition) & their mock exams are very good for real exam.
The exam questions are very similiar to or easier than that.

Once again thanks to HFSJ authors...

Thanks
Ritesh

12 years ago
Hi Rancher,

any one please clear my doubt.
Hi Jothi Shankar

Thanks for your reply, But i still confused with HFSJ Book and Errata

A/c to you "If there is a forward slash, then it is with respect to the ROOT of the web app."

Then in Book page no 136 The last paragraph (and code) is Right--

"relative to web app " So the new URL will be: - http://www.wickedlysmart.com/myApp/foo/stuff.html


whereas errata tells its wrong it should be --
"relative to the web container" So the new URL will be:- http://www.wickedlysmart.com/foo/stuff.html

please tell me Book is right or Errata on this regard ?
I am confused with HFSJ Book page no. - 204 and HFSJ errata for the
page no.- 136

HFSJ Book page 204
Topic - RequestDispatcher revealed


under the paragraph --
Getting a RequestDispatcher from ServletRequest---

RequestDispatcher view = request.getRequestDispatcher("result.jsp");

Here Book explain like --"if the path starts with a forward slash ("/"),the container sees that as 'starting from the root of this web app' "


Whereas HFSJ errata for page no. 136 explain forward slash ("/") as -

----------------------------------------------------------------------------
The last paragraph (and code) should read:
The Container builds the complete URL relative to the web container itself, instead of relative to the original URL of the request. So the new URL will be:
http://www.wickedlysmart.com/foo/stuff.html
----------------------------------------------------------------------------

Please explain forward slash ("/") - means
"relative to web app OR web container"
Thanks Srinivasan and Jothi for your reply .
Is static variable in servlet Thread safe ? please explain.
hi
Rupak

thanks for your response***********************

ritesh.
hi
Rupak & ALL
coudld u plz. paste the full code of your query.
i try to compile the code ---

import java.util.*;
class Treeset1
{
public static void main(String[] args)
{

TreeSet ts = new TreeSet();

ts.clear();

ts.add(0.1);
ts.add(3.0);
ts.add(100.0);
ts.add(13.2);
ts.add(5);
System.out.println("The size of TreeSet is = " + ts.size());
Iterator itr = ts.iterator();
while(itr.hasNext())
System.out.println(itr.next());


}
}

BUT I FOUND THE COMPILE TIME ERROR.I UNDERSTAND THIS BECAUSE
argument to the add method of TreeSet should be an object.
BUT I DONT KNOW HOW THESE DOUBLE VALUES ARE ADDED IN TREESET?

ANY ONE PLZ. HELP---.......----.....

I ALSO NOT UNDERSTAND THE
Set<Double> ts = new TreeSet<Double>();IS IT WRITE SYNTAX?

IS THIS TYPE OF QUESTION ASK IN SCJP 1.4?

WITH REGARDS
RITESH
hi
vishnu
i think u r right.


--------------------------------------------------------------------------
there is no any way to predict the output without using a compiler, unless you happen to be an expert on floating-point bit patterns.
---------------------------------------------------------------------------



ritesh
hi
vishnu

are you find the answer of your question?
i am still confusing .

plz. explain me the answer--
equal unequal ----
especially with respect to long & int .

with respect
ritesh
hi
vishnu

are you find the answer of your question?
i am still confusing .

plz. explain me the answer--
equal unequal ----
especially with respect to long & int .

with respect
ritesh
Thanks all

for your responses. i bought K& B in new mumbai,vasi , paid for this
Rs.- 346. really this price is worth to spend for k& B.

with regars
ritesh
hi
i am from mumbai, india.
preparing for scjp 1.4. I want to know...

if any one know ,plz let me know---

what is name of publisher of K&B book in india ?
what is the price of it in india?


with regards
RITESH
16 years ago