Bill Shirley

Ranch Hand
+ Follow
since Nov 08, 2007
Merit badge: grant badges
For More
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 Bill Shirley

You should prob'ly use a DOM library if you can find one. There are a variety of them that are tailored toward various uses.

If you are absolutely certain that the string you want to change will not be part of the markup, you could certainly use StringBuilder/StringBuffer. (i.e. "Frankensteen" => "Frankenstein")
15 years ago
The object references are passed by-value not by-reference.
Even if they are named the same, they are different variables in different scopes.

The StringBuffer object the local variable is pointing to is mutable, and is changed in the method. So, it is still changed when the method returns, though the reference has gone out of scope.
15 years ago
This is obviously not actual java code. If you Post Real Code we can better help you.
15 years ago
are you asking for "greatest common substring" rather than an "overlap"?
15 years ago
Peter Svensson,

Dojo only provides portion of DOM manipulation. Where incompatibility in browsers exists or APIs are not defined.

Does "Learning Dojo" provide a reference to these standard DOM APIs? (perhaps in an appendix) If not, what would you suggest as a reference for those APIs?

Are there any extensions to Dojo that provide additional DOM manipulation, perhaps for specific formats of manipulating?
If you understand the computer science basics, there is only one possible answer (it's almost a language neutral question). Having had to learn assembly language on several different processors way "back in the day", I can tell you I have great familiarity with it.

All references that are local variables are pushed onto the stack. They go out of scope, and are reclaimed when the method exits.

All references that are instance variables are part of the object they are within and are implicitly created with that object. If all objects are on the heap, then the reference from within that object is there as well. If there is some stack optimization in a later Java revision then the reference is inside that.

If you need us to give an example of an instance variable � well, then I think I'll wait until you ask for that.
15 years ago

As I understand correctly, with Java 5.0 vector should be parameterized.



I'd say it "could" be parameterized.
15 years ago
That's a nice homework problem, however we suggest you Do Your Own Homework (FAQ).

Aside:
I've always thought professors would be better off giving early program assignments with code that performs the I/O already and input test files, so that new programmers can see some code and learn from it, and modify the code to do the crux of the work. Later in the term they can get the I/O part dumped on them.

Get some of it going, and if you have particular questions about your code as us.
15 years ago
To restate the same information that's already been presented:

1. Why are members of an interface always public?



It should be obvious why they are never private. Declaring a private interface is a meaningless statement. If you are "inside" a class, you can see what is private, and don't need any interface telling you what to do.

Since protected is only available to subclasses, defining a protected method in a class effectively imposes the interface that subclasses need to implement (if you define protected abstract methods in an abstract class).

The only reason for an interface is to define a desired public interface to multiple unrelated classes. (there are actually other reasons - but their not applicable to your question)

2. Why is the finalize method protected?

All classes will have a finalize method, but they cannot invoke the method on other classes. Indeed, they shouldn't invoke it on themselves either, but that can't be restricted by the interface. It will be invoked externally, and it can be overridden - in which case it should invoke super's implementation of it to correctly implement it.

(As noted above, if you are aware that an object is ready to be disposed of, it's best to clean up its resource use immediately rather than wait for any garbage collection cycle.)
15 years ago
FAQ: Use A Meaningful Subject Line

welcome,

history note:
the good ol' switch statement comes down to us from the C programming language, the first step up from assembly programming, and as such still requires a little bit more work to do what you want it to,

(i.e. check on the break keyword as suggested above - and/or trace through the debugger and see how it's executing)
[ November 17, 2008: Message edited by: Bill Shirley ]
15 years ago
Yes.

if a reference to an item in the list is not a "new data structure", then many sort methods will do - use one that maintains previous sort order, and doesn't require additional data structures (most of the simpler ones don't)
15 years ago
If the class will never see the light of day anywhere else, then NO you don't need to implement hashCode.

you can certainly easily implement it to return data.hashCode and be done with it as well,
15 years ago
Computer Science 101:
knowing what a stack and a heap are would be a start,
(you've provided us with nothing, so we must assume your ignorance)

try Wikipedia for a background,
15 years ago
provide the full text of the actual error
15 years ago