我是新手, 在自學java, 還是有些糊塗, 請問誰知道怎麽寫啊?
關鍵是第7步不知道怎麽寫
Write a class Name that stores a person's first, middle, and last names and provides the following methods:
1. public Name(String first, String middle, String last) -- constructor. The name should be stored in the case given; don't convert to all upper or lower case.
2. public String getFirst() -- returns the first name.
3. public String getMiddle() -- returns the middle name.
4. public String getLast() -- returns the last name.
5. public String firstMiddleLast() -- returns the person's full name in order, e.g., "Mary Jane Smith".
6. public String lastFirstMiddle() -- returns the person's full name with the last name first followed by a comma, e.g., "Smith, Mary Jane".
7. public boolean equals(Name otherName) -- returns true if this name is the same as otherName. Comparisons should not be case sensitive. (Hint: There is a String method equalsIgnoreCase that is just like the String method equals except it does not consider case in doing its comparison.)
8. public String initials() -- returns the person's initials (a 3-character string). The initials should be all in upper case, regardless of what case the name was entered in.
9. public int length() -- returns the total number of characters in the full name, not including spaces.
求教: 關於java, 真是不太明白
所有跟帖:
•
你是哪個學校的
-更我前年的作業類似啊-
♀
(0 bytes)
()
03/23/2005 postreply
01:31:30
•
回複:求教: 關於java, 真是不太明白
-xunqi-
♀
(394 bytes)
()
03/23/2005 postreply
03:56:52
•
回複:求教: 關於java, 真是不太明白
-sgnx-
♀
(349 bytes)
()
03/23/2005 postreply
07:40:45
•
This is a good one, last is 亂彈
-Java鑒定家-
♀
(0 bytes)
()
03/23/2005 postreply
09:06:26