Himanshu Kansal

Ranch Hand
+ Follow
since Jul 05, 2009
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 Himanshu Kansal

Did you find a solution? I've got this exact same issue. I'm using a Mac.
12 years ago

Harry Henriques wrote:Can you explain why the instanceof operator doesn't return false?

output True?

Just for confirmation you can try fully qualifying Collection as java.util.Collection
Writing stockID[0] does no good. While mapping the setter from the bean is called. Here it would try to call setStockID[0]() which obviously would not be there in your bean.

okay, I just stole some time to verify the array thing. Suppose you have 2 texboxes with same name, say myTxt, then they are mapped to an array myTxt provided there is no index violation.

While mapping this to the form beans, the method public void setMyTxt(String[]) would be called. here you can assign the reference accordingly. I checked this and it is working fine. However to get this value back you need use the array's index as I said earlier.

Since myTxt is an array, you cannot print myTxt, but myTxt[0] or some other valid index.

for the <html:text... teg you need to use EL.

14 years ago

According to what you are trying to do, things are happening correctly. You asked it to output the array object and that is what it gave u.

Concept of arrays for forms is that when you have a control like a series of checkboxes, you can use an array in your form to hold multiple selected values. The values in case of textboxes would normally be overwritten, instead of being mapped to arrays. I am not very sure but I think this is what happens to textboxes.

Still, if I assume that in case you have multiple textboxes, all with the same name attribute, and they do get mapped to the array in your form, then when you have a single textbox, you still would require to refer to its value through the array index, stockID[0] that is.
14 years ago
One problem I see is about the missing code tags.

Next, you instead of refereing to instance variables in the constructors, create new automatic ones.
14 years ago

Jothi Shankar Kumar wrote:You can also handle them using control files. I'm not sure if MySQL has such a thing, but I've done that using Oracle.

You mean to say the sqlldr facility given by Oracle, using control, data and log files!
String formatter is your best bet to save effort. Looping and batch statements are a boon, use them.
Alienware would be my choice
14 years ago
That's too much of a code in a method without abstraction.

Also you could use simple arrays to eliminate a lot of sysouts.
14 years ago
Kudos for that!

Well, I hope you are clear with the static thing now.
14 years ago

Bryan Peach wrote:Yeah i understand that part, but what I'm not sure of is how do I pass those values to the constructor? Whats the syntax I guess for passing values to the constructor?

Er... I think I am seriously missing something here. Okay! Do you get problems when you do the following if numerator and denominator are not static :

Or do you get problems in converting the input strings to numbers?

Or if it is something else, please clarify!

14 years ago

Muhammad Ali Khojaye wrote:quote from Effective Java

Each instance of a nonstatic member class is implicitly associated with an
enclosing instance of its containing class. Within instance methods of a
nonstatic member class, you can invoke methods on the enclosing instance
or obtain a reference to the enclosing instance using the qualified this construct

A static nested class does not have access to the enclosing instance.

That would indeed be the most appropriate explanation.
14 years ago
Hey Bryan,
If you plan to take values from the user, as in from standard input, then you can simply create objects of the Fraction when you actually GET the input. Prior to that you really do not need to have references to those objects.

Also, as Salvin said, here making the variables and references static does not serve a meaningful purpose that we are aware of. If you want ALL the objects of your class to share same values, i.e. if you want ALL your fractions to be same, then you should use static.

Making numerator and denominator static would mean that a fraction holds its unique(input by user) value only until a new fraction is created.

14 years ago
A static inner class cannot be an inner class in its true meaning because an inner class would closely relate, have a special relationship, to the instances of the outer class created; and it is evident that static has nothing to do with instances in particular.
14 years ago