私はPersonsのクラスを開発していますが、それについて1つか2つの質問があります。
/**
* ADT for persons which is completed which subclasses
* to creating actors with specific properties
*/
public class Person {
/**
* Name of the Person.
*/
public String name;
/**
* The World which this Person is associated with.
*/
public World world;
/**
* Tells where this Person is at the moment.
*/
public Place where;
/**
* The inventory, contains Things.
*/
public Collection<Thing> inventory;
/**
* Shows how the Person looks like
*/
public Image appearance;
/**
* Create Person named `name' in world `world'.
*
* @param world The world where the Person is created.
* @param name Name of the Person.
* @param app An image used to display the Person.
*/
public Person( World world, String name, Image app ) {
this.world = world;
this.name = name;
this.appearance = app;
where = world.defaultPlace();
where.enter( this );
inventory = Collections.synchronizedCollection( new LinkedList() );
}
..。
Personクラスはパブリックにする必要がありますか、それともデフォルトのアクセスの方が良いでしょうか?ここでの意味はまったく同じではありませんが、個人、個人の個人が公開されるべきであるのは少し奇妙ではありませんか。
IDEが警告を発した場合、警告をどのように処理すればよい
inventory = Collections.synchronizedCollection( new LinkedList() );
ですか?それは私の型安全性について警告します。
ありがとうございました