Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Suppose that you need a FullName class, which will contain a person's first name and last name.?
There are two different ways of implementing this.
A. The public variable version:
class FullName
{
public String first;
public String last;
}
B. The bean-style accessor version:
class FullName
{
private String first;
private String last;
public String getFirst() { return first; }
public void setFirst(String s) { first = s; }
public String getLast() { return last; }
public void setLast(String s) { last = s; }
}
Questions:
1. What are the benefits of using the public variable version?
2. What are the benefits of using the bean-style accessor version?
3. Add a constructor to your preferred version, that takes two String parameters and initializes first and last.
1 Answer
- JuanaqueñaLv 71 decade agoFavorite Answer
Your question looks more like a question on writing computer code and not within the area of Genealogy. I recommend you ask your question in the Programming section of the Computers Division of Yahoo Answers.