Scott Kiel

Greenhorn
+ Follow
since Jan 05, 2001
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 Scott Kiel

That was it. Thanks. I didn't expect all that whitespace.
16 years ago
JSF
I am not able to see the html source for an h atatable component. The data appears normal in the browser but there is no source html for the table. Has anyone else run across this problem?
16 years ago
JSF
Mukti,
-10 is actually represented as 1111....11110110. If this is unclear to you, you might want to review 2's complement representation.
Hope this helps.
Hi all,
I have had trouble here also.
Q41. Answer B is correct as well as A and C. Static methods cannot be overriden but they can be hidden. If you try to override a static method to non-static you get a compile error. If you try to override a static method to another static method you get no compile error but you are hiding the original method instead of overriding and therefore no delayed binding.
Hope that is clear.
Esenih,
I had a similar question not long ago. As I understand this, variable references are determined at compile time by reference type and method references are determined at runtime by object type. In this case, when the base classes' constructor is called, the reference to amethod is determined to be RType because that is what type the object is.
scrollpane
inheritance hierarchy available in api documentation at: http://java.sun.com/j2se/1.3/docs/api/index.html
My RHE edition gives the answer as false - a component may have an unlimited number of listeners (including adapter subclasses) whether or not it has explicitly called enableEvents().
I agree with sasi except on Q2. b is not correct because abstract methods have a semicolon, not curly braces.
That's an interesting problem that I don't have the answer.
The second operation is =+ which to me says assign a positive value. In this case its simple assignment so no arithmetic promotion occurs and it does not compile because it tries to assign an int to a char without an explicit cast.
The first operation has me stumped. My explanation would be that the first operator (+=) is add and assign. This can be rewritten c = c + i; In this case arithmetic promotion occurs so the ch is promoted to an int. But to store the result should require a cast to an char since this is a narrowing conversion. Can anyone shed some light on why this succeeds without the cast.
The first problem gives a compile error because the class implements the WindowListener interface without implementing all the interface's methods. (There are 7 and only windowClosing is implemented).
The second part had me puzzled too. After much thought it occurred to me that for 3 you are concatenating an int and a String but then trying to assign the String into an int. 4 is incorrect for the same reason except that it is being assigned to a char. Hope this helps.
I agree the second part is the more interesting but for the first part b does not work. There are two methods for round but as I read the question it is not calling the method that returns an int. It is calling round with an argument that is a double. This returns a long which requires a cast to be squeezed into an int.
Q1. I think Sachin is right. 2 objects created in the pool and one by concatenating.

Q2. Depending on what assumptions we make, I believe A is still a possible correct answer. The subclass has had a constructor explicitly created. That means the default constructor is not created. There could be an no argument constructor, if it was explicitly included by whoever wrote the class.
Vladimir,
I think b is incorrect. Math.round(double d) returns a long which would require an explicit cast to int as in c.
Ash,
I think you are not getting a compile error because the local variable is shadowing the member variable. The Java Specification says
"A declaration d of a field, local variable, method parameter, constructor parameter or exception handler parameter named n shadows the declarations of any other
fields, local variables, method parameters, constructor parameters or exception handler parameters named n that are in scope at the point where d occurs
throughout the scope of d."
Try the following code:

The output is
12
5
because the local i shadows the member i, which can be referred to by class name because it is static.
Hope this helps.