×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Not a problem at all. While I feel I understand how Java works (for the most
part) and I can write classes to do all kinds of this, I lack in the
understanding of how it should be done more than how to do it.
I think part of my problem is I look for examples and here is what I get.
public class Person {
private String firstName;
private String lastName;
public Person() {
firstName = "";
lastName = "";
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
...
}
From what it sounds like ideally you don't want to do that. You want a class
that knows about a Person, but for most classes the just need to know it's a
Person and not a Dog. So generally speaking public getters and setters
should not be there. This is obviously not true 100% of the time, but I
think that's what is supposed to happen.
You are correct, there is no reference to polymorphism, but I have an old
copy of Thinking In Java that's pretty good. I suppose most of the concepts
are still the same. I think I'll have to read that chapter this weekend. I
might have one of those, "Oh.... ...I get it moments". That's usually what
happens to be, just wake up one day and finally get it :-)
--
James R. Perkins
As an Amazon Associate we earn from qualifying purchases.