- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Java语言程序设计面向对象特征
字符串操作类 第三章 面向对象特征 java.util.StringTokenizer类 方法举例 String s = this is a test; StringTokenizer st = new StringTokenizer(s); while (st.hasMoreTokens()) { System.out.println(st.nextToken()); } 运行结果: this is a test String s = this:is:a:test; StringTokenizer st = new StringTokenizer(s, :); while (st.hasMoreTokens()) { System.out.println(st.nextToken()); } 运行结果: this is a test 执行外部程序 第三章 面向对象特征 java.lang.Runtime类 public Process exec(String command) throws IOException Executes the specified string command in a separate process. public Process exec(String[] cmdarray) throws IOException Executes the specified command and arguments in a separate process. 执行外部程序 第三章 面向对象特征 java.lang.Runtime类 Window NT/2000/XP cmd.exe /C 命令 Windows 95/98 /C 命令 执行外部程序 第三章 面向对象特征 java.lang.Runtime类 import java.io.IOException; class Test { public static void main(String args[]) throws IOException { Runtime.getRuntime().exec(cmd.exe /C + args[0]); } } 第三章 结束 ! 第三章 面向对象特征 人有了知识,就会具备各种分析能力, 明辨是非的能力。 所以我们要勤恳读书,广泛阅读, 古人说“书中自有黄金屋。 ”通过阅读科技书籍,我们能丰富知识, 培养逻辑思维能力; 通过阅读文学作品,我们能提高文学鉴赏水平, 培养文学情趣; 通过阅读报刊,我们能增长见识,扩大自己的知识面。 有许多书籍还能培养我们的道德情操, 给我们巨大的精神力量, 鼓舞我们前进。 * java.lang.Object类 第三章 面向对象特征 Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class. 子类可以对Object类的方法进行重写 构造方法 --- public Object() 实例方法 protected Object clone() throws CloneNotSupportedException public boolean equals(Object obj) protected void finalize() throws Throwable public final Class getClass() public int hashCode() public final void notify() public final void notifyAll() public String toString() public final void wait() throws InterruptedException public final void wait(long timeout) throws InterruptedException public final void wait(long timeout, int nanos) throws InterruptedException java.lang.System类 第三章 面向对象特征 静态变量 public static final InputStream in (标准输入流) public static final PrintStream out (标准输出流) public static final Print
文档评论(0)