Yash Sharma

Ranch Hand
+ Follow
since Jan 30, 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 Yash Sharma


I guess you didn't read the question or try to dry-run the program

There are two methods m and n, out of which m is surely overridden in the subclass. My question are two fold:
1) Why does the main method when run, prints "m from B, n from A" instead of "m from B, n from B"?
2) Why does the Javablackbelt answer says that method "n" is overloaded?



P.S. If moderator deem it correct they may move the question to Beginners forum.
15 years ago
I must have forgotten all my OOP fundamental. I had this question at Javablackbelt.com and am not sure why the answer should be m from B, n from A. The answer says that method n is overloaded in subclass but I though overloading only works in the same class. Can I request you to please explain the behaviour?

15 years ago
Thanks a lot everyone. So for SCBCD its actually JDK1.5 + SCBCD for me Tough job.

A related question: Does preparing for SCBCD help me in clearing SCEA Part-1 as well?

I am planning to prepare for SCBCD5.0 (on EJB3.0).
1. Would I need to write code in JDK 1.5 syntax to pass it? I have been working on Jdk1.4 so far.
2. I clared SCJP 1.2 5 years ago, do I need to upgrade SCJP first? Am I eligible to write SCBCD5.0?
3. Also I hear that my HF EJB book has now gone to waste? If I were to buy only one book for SCBCD5.0 which one should it be?

Thanks for your advise.


I want to have a build file at the root for all my webapps that would recursively build all the webapps, albeit there would be no build files for individual webapps.

Here build-macro is a macrodef that would take care of building each webapp.

What I am not able to comprehend is how do I pass the name of the webapp folder to the macro. I don't want to hard code names as I want it to be generic to be able to handle any number of webapps in future without any changes in the build file. Note that individual webapp folders don't have a build file (or I could have used the subant task instead).

15 years ago
As I mentioned, the intention is:
1) Ability to add new utilities with minimal code changes
2) Easier code maintenance
3) Should go with Portlets

I have a Portlet application where I need to collate some utility JSPs that our team had written at various times. These utilities are standalone JSPs, for example one of them lists all running threads in the JVM, another reads the Manifest of a given JAR and so on. With a view that new utilities could be added and the code from JSPs have to be moved to a Portlet, please suggest appropriate Design pattern that could be applied here.



Thanks for your replies. I am surely not mentioning Singleton class or a protected constructor here, not even a protected variable but a "protected static method" as mentioned above. Is the purpose to make it binding that before calling the method one must provide some implementation in a subclass? I would appreciate if somebody could tell me where in "real world" you would go for such a technique.

I was recently using an API and encountered the problem when trying to use the method threw an error saying that the method is protected and I had to do something like the code above.
17 years ago
What would be the design reason to make any method "protected static"? I am confused.
17 years ago
Has anybody had experience with CSC, especially howz their Indore unit. How is Java work there? How is the work culture compared to say Patni, Kanbay etc. Any inputs from people who have worked there would be appreciated.
18 years ago
I have a doubt. I have a task on hand where I have to port an application from one framework to another. Image we have a super class "GrandDad". Now, one of class hierarchies (in Framework 1) is:
Grandson extends Son extends Father extends GrandDad

Another hierarchy (in Framework 2) is:
Uncle extends GrandDad

In porting from FW2 to FW1, if I make change such that: Uncle extends Grandson (I do this so that I get all the new functionalities that were added to GrandDad by the Father, Son and Grandson).

What impact will it have on my design? Or am I doing something evil?
18 years ago
I am confused about the approach I should take on this.

I am using XML as my data-model. A web-based GUI would prepare the GUI from this XML. Let's say this is a Book XML where using the GUI user could (1) select his preferred chapter and (2) Save this choice. To generate the GUI and saving user's preference I plan to use the same XML (say master.xml).

The XML:

The GUI can certainly be made from this, a drop down containing all the chapter titles and a button to save the preference. When the user saves it, the XML would be saved (as say user_xyz.xml) and looks like:

So far so good Imagine now that the author adds few more chapters so the XML now becomes:

I see no problem in saving a new preference the GUI dropdown will now display four chapters instead of two. However, what if the user XYZ decides to alter his preference, if my GUI is created using "user_xyz.xml" the GUI is not aware of the additional two chapters now available. If it is created using "master.xml" it has no knowledge of the user's previous preference.

I hope I made myself clear. Should then my approach to creating the GUI be parsing both master and user's XML and then create it, could be taxing if XML is complex and bulky. Or should I update the user's xml every time master changes, again how will I update it. Or is there any other suitable approach?

Thanks for your time.
I have a scenario where my data-model is XML and I have to generate a JSP from this based on a template. This XML is not as simple as the Book.xml discussed in the examples of Freemarker.

Now I am stuck with how to get the attributes, Say I have the XML:

<title>Test Book</title>
<chapter title="Chapter 1" pages="2">
<para title="First Para" weight="1" align="Left">p1.1</para>
<para title="Second Para" weight="3">p1.2</para>
<para title="Third Para" weight="2" >p1.3</para>

In this case the Nodes have "attributes" some are not mandatory (may be there or may not be), what I mean to say is that the number of attributes for an element is not fixed.

When I display the ${.node?node_type} I always see the type as "element", the attributes are not traversed. I know I must be doing something stupid (I do not have any experience with XSLT etc). I was not able to locate a solution at the docs.

Can anybody help me with this? A pointer to some existing resource would also help a lot. Thanks for your time.

[ February 01, 2005: Message edited by: Yash Sharma ]
Sorry if this sounds naive I want to use the ?Freemarker ANT task to generate an HTML representation for my XML based on a template. However I want to do this using my program on the fly, which means that I must be able to call the ANT task from inside my Java program.

Can we call an ANT task from a Java Program or JSP?
19 years ago
I don't know whether this was too stupid a question.

I also wish to ask whether "Velocity" fits the bill here ?