nate saider

Greenhorn
+ Follow
since Jun 24, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 nate saider

Is there anyway to indent output based on the integer value of an variable?
for example...
if

then

will indent "hello" three times over and output
>[/n][/n][/n]Hello
and not
>Hello
thanks.
[ July 29, 2002: Message edited by: nate saider ]
21 years ago
Dirk:
I guess that is a matter of semantics. (I jest)
Snigdha:
That's great. That was very clarifying (especially the code example). Thanks.
21 years ago

Originally posted by Shane Roylance:
I like "Java How to Program" Deitel & Deitel.


Ugh ... I can't stand this book. It is good if you really need specific problems solved... but I would not use this to learn from.
I would suggest Ivor Horton's beginning Java 2 (SDK1.4). It's really helped me out of several jams and been useful to learn from.
21 years ago
I'm not sure this is the right forum for this question... but what is the difference between syntax and semantics of a programming language?
Any examples?
21 years ago
Thanks Jim. That's what I ended up doing.
Always good to have validation that there was no simpler solution.
21 years ago
Whoa.
That's pretty neat. I tried it, but I would still need to convert from a string to a number before applying that if statement, otherwise it checks if the string is a number and proves false
21 years ago
I've got an array of type string
for example,
String array[]={"b", "2", "a", "2.4"}
I want a for loop to access this array and perform one action if the string is a long integer, or another action if the string is an alphabet non-integer.
Now so far I gather that I should use parseLong or parseInt to get the integer value.
I know that if I use these methods on the string "b" I'm going to get a NumberFormatException and it won't continue to check the remaining strings for type Int.
How do I get around this? (perhaps a Try...catch?)
like this:
21 years ago
It sounds like we are taking the same class.... since I have similar issues.
I believe dual dispatch or multimethods come in handy in for your first question, but your question is vague.
I don't think you can have one class hierarchy implementing 2 interfaces with the same method name. BUT you can have two interfaces handling methods of the same name in separate class hierarchy.
The obvious guess from my basic knowledge of Java is that each interface has two different sets of derived subclasses inheriting these methods.
(i.e method gumbo()from interface A is being used by subclasses A, and method gumbo() of interface B is being used by subclasses B [the names A & B I used don't matter... I was just using them to point a relation between subclasses and each interface])
Maybe that is too obvious an answer... but I can't imagine why anyone would have 2 interfaces with the same method name in the same class hierarchy.
[ July 09, 2002: Message edited by: nate saider ]
21 years ago
Anyone care to explain what dual dispatch is or give an example? (i.e. multimethods in Java)
From what I understand you can create an independent object, then send a method containing varying arg types. Then polymorphism magically selects an object/class with that set of arg types and responds accordingly? And that demonstrates dual dispatch.
Does that sound about right?
Examples would help (simple examples!)
Thanks.
Nate
21 years ago
Um... thanks. That is actually helpful.
What's not good design practice about it?
It gets the job done and it's homework for a professor who didn't teach us Java, but expects us to know it even though it is not a requirement for the class. I say it is GREAT design practice for someone who learned a semblence of java in 4 days.
well, it's 4 am and time for bed. Thanks again
21 years ago
Can anyone tell if it is possible to check if a variable is of a primitive type?
i.e
21 years ago
Definitely preferred the more efficient site-busting method of search (the OLD method)
It accomplished the task at hand quite readily...
now search is as exhaustive as searching the entie internet.
21 years ago
So far this is what I am assuming that I import in the object I want to test via

Does this have to be done if in the same package?
then within main(String[] args), I presume one simply says

if you are passing the variables to the constructor of that object and/or

if you are passing the variables to a method of said object.
21 years ago
Any suggestions how I can pass these variables with assigned classes to my other object classes to evaluate? I am doing this to test my program that takes two inputs and compares whether their classes are similar or not.
Nothing I tried works.... So I feel I am misundertsanding how Main() works with other objects/classes:

Thanks.
[ June 24, 2002: Message edited by: nate saider ]
[ edited to re-format code -ds ]
[ June 24, 2002: Message edited by: Dirk Schreckmann ]
21 years ago
Sorry about the names..dirk.. I have had little sleep in the last 2 days....
hmmmm.... this does not look like it is feasible in the context of what my project is. I think I will have to make my parent class variables not "final" and initialize them through some other method outside of the constructor.
thanx.
[ June 24, 2002: Message edited by: nate saider ]
[ June 24, 2002: Message edited by: nate saider ]
21 years ago