Arul Prasad

Ranch Hand
+ Follow
since Jan 20, 2005
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 Arul Prasad

Thanks a lot,

Peer Reynders , Nitesh Kant.
hi kenji kunoichi,

Design Patterns are basicaly some solutions or some sequence of steps if we follow we can achive many advantages we will say it as GRASP.

For a better start i suggest you to read Head Fisrt Design Pattern or
Design Patterns: Elements of Reusable Object-Oriented Software.

If you need a clear idea about GRASP.Read
Thanks, Why can't we go for an Decorator pattern ..?

because i have sections like A,B,C,D,E.

but all the data maniupulation,validation i have to do it for all the sections or gorup of combined sections based on my runtime condtions.

Wiki Decorator
Consider my case and tell me which pattern will be a good solution.

I have one entity called EntityA

which is consist of Section A , B , C , D , E.

Under the dynamic cases these sections will be included, for example

Case 1
Entity 1 consist of Section A , C, D, E.

Case 2

Entity 1 consist of Section A , B , C, D, E.


In each section i have many fields to fill and i have to do the following operations

1) validate each sections

2) save the data for the each sections.

[ April 23, 2008: Message edited by: Arul Prasad ]

I need one clarification of Sax parser in order of parsing the xml documnet

say for example

<Attribute Name="Name" Desc ="name" />
<Attribute Name="Amount" Desc="amount" />

whenever i parse the xml i need the first element as "Name" and the second one as "Amount"

SAX will read the xml document forward only ..?
hi Barry

thanks , now i got it , so your telling about the object of the particular type. but i wrongly thought it as a Inheritance Relations "is a" type of relation.

hi Amitabha Batranab

I think you confused because of the term Wrap . Well let me explain.
The PrintWriter has these constructors

PrintWriter(File f) (as of Java 5)
PrintWriter(String filePath)(as of Java 5)
PrintWriter(OutputStream os)
PrintWriter(Writer writer)

so when you want to work with the PrintWriter atleast you need any one of the objects (File ,String ,OutputStream ,Writer )

As you know the Writer and OutputStream are abstract classes they can be instantiated through their concrete sub -classes only.

coming to your doubt in which order you need to use these . Lets take an example to write a String in the File through Writer. you can use the any of the following

1) creating File Object pointing to existing File , Passed to the
PrintWriter (new Fashion in java 5)

2) create String with the valid path of the File Passed to the
PrintWriter (new Fashion in java 5)

3) create a FileOutputStream pointing to the File , passed to the
PrintWriter (old fashion )

4) create a type of writer may be a BufferdWriter which again need a FileWriter . Create the both and passed to the PrintWriter constructor.

hope i'm clear to you . This we are calling as a decorator pattern used in Java you can see more details about this in

Head First Design Patterns - Kathy Sierra (More cleared Explanation)

Decorator Pattern
[ September 05, 2006: Message edited by: Arul Prasad ]
hi Barry

y is a B. You can assign a B to y or you can assign a subclass of B to y.
You cannot assign a super class of B to y.

Hope Y is a B was wrong in terms of your explanation. I hope it was B is a Y .

For example :

MyFrame is a Frame.


So Frame reference variable can hold Frame , MyFrame , is a MyFrame (subclass) or null
"Instance variables are defined inside the class, but outside of any method, and are only initialized when the class is instantiated."

In every constructor the first line execution will be calling the default constructor of the base class (super()) or calling another overloaded constructor (this())

so in this when the Class Z initialted , the instance variable 'y' got initiated So now the Y's constructor will called. and then the Z's constructor called , before the execution it calls the x's (base class) constructor like

thats why you got the YXYZ ... hope it will help you
can anyone explain be about the difference between the URL and URI . in web.xml we are saying for the tld like <taglib-uri> , why cant WE specify it as <taglib-url> ..?

hi Srini

Yes I have also think that reason. but if Collection can use the Genrics . why can't this ObjectOutputStream and ObjectInputStream . Even Collection also can written in to the File. Which can contain the list of many type of Objects.
14 years ago
is there any way to use Genrics in the ObjectOutputStream & ObjectInputSream. in Java 5.

My case wass I'm having a Animal class which need to be written in to one file and read it from the file.

If i am using the ObjectInputStream to read . I need to type cast it explicitly when i am saying

Animal a = (Animal)objectInputStream.readObject();

Can we use Genrics for avoiding this Type cast . Is any thing avail with java 5 if not why it was avoided ...?

14 years ago
Good Work :-) All the Best . Wow ! You have proved it
14 years ago
hi Volker Glave
you are right , but i hope this question is not concentrating on which line Compile Error has occured , but it was the reason why the compilation fails , eventhough the compile Error happen in the line No 8 ';' expected

but the reason was not the illegal statment in line no 8 but it was because of the illegal statement in the line 7 ...

hope i am right ...
[ August 16, 2006: Message edited by: Arul Prasad ]
in Lesson No 7 and for the question no 16 i have a doubt

question was ...

Given a method declared as:

public static <E extends Number> List<? super E> process(List<E> nums)
A programmer wants to use this method like this:

output = process(input);
Which pairs of declarations could be placed at // INSERT DECLARATIONS HERE to allow
the code to compile? (Choose all that apply.)

A. ArrayList<Integer> input = null;
ArrayList<Integer> output = null;

B. ArrayList<Integer> input = null;
List<Integer> output = null;

C. ArrayList<Integer> input = null;
List<Number> output = null;

D. List<Number> input = null;
ArrayList<Integer> output = null;

E. List<Number> input = null;
List<Number> output = null;

F. List<Integer> input = null;
List<Integer> output = null;

G. None of the above.

B, E, and F are correct.

but i 'm getting the compile error can any aone help me ...

Error ..
------------ incompatible types
found : java.util.List<capture of ? super Base>
required: java.util.List<Base>
List<Base> subList = print(bList);
1 error

It was compiled after the change in line 23 as

now i need to know about the correct answer and also the use of the super keyword ....

is there anyone help me