05 2013 档案

摘要:题目要求:Following the form of the example Lunch.java, create a class called ConnectionManager that manages a fixed array of Connection objects. The client programmer must not be able to explicitly create Connection objects, but can only get them via a static method in ConnectionManager. When the Connec 阅读全文
posted @ 2013-05-19 21:59 等待电子的砹 阅读(878) 评论(0) 推荐(0) 编辑
摘要:题目要求:实现一个表示电话号码(要求带有区号和号码,如010-68911205)的Phone类,其中某个构造函数的参数应为表示电话号码的字符串。要求实现相应的set和get 函数来分别设置及获取电话号码中的区号(area,如010)和号码(number,如68911205),重写Object.toString( )函数打印出整个电话号码。(提示:可使用String.indexOf( )和String.substring( )等函数)设计思路: 在Phone类中,使用两个String对象分别存储号码与区号,在构造方法中,将格式为 区号-号码 的电话号码分割为两段,使用Object.indexO. 阅读全文
posted @ 2013-05-19 21:52 等待电子的砹 阅读(741) 评论(0) 推荐(0) 编辑