Text input with Scanner, Creating objects, Graphical Output.ppt

Text input with Scanner, Creating objects, Graphical Output.ppt

  1. 1、本文档共28页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Text input with Scanner, Creating objects, Graphical Output

* ? Peter Andreae, Xiaoying Gao ? Peter Andreae, Xiaoying Gao ? Peter Andreae, Xiaoying Gao Input Using Scanner Output Using DrawingCanvas COMP 102 #7 2010 T2 Xiaoying Gao ( Sharon) Computer Science Victoria University of Wellington Menu Input using a Scanner Create a new object from inside a program Graphical output Admin Today’s lab at CO238: 2-3 Assign 2 due this Wednesday 10am Test: Friday next week on 6 Aug Design a method: Input, output Input Using BlueJ, a method can get input using parameters JOptionPane Scanner Output Using a predefined object System.out: System.out.pritnln(..), System.out.printf(…,…) Return a value Interactive Programs How can we make programs interact with the user? Output: Use the System.out object to print on the “terminal window” Use fancy user interface objects, like JOptionPane. Use a DrawingCanvas object to draw graphics in a window Input: Use Bluej’s special facilities for calling methods with arguments Use fancy user interface objects, like JOptionPane Use a Scanner object and the System.in object to get input from user typing in the terminal window. Use even fancier user interface objects to get input from the mouse, buttons, sliders, etc Get input from files. Output with System.out System.out contains a PrintStream object (attached to the terminal window) What actions can a PrintStream object do? Terminal System.out: PrintStream-2 Output with System.out The documentation says PrintStream objects can println(anything ) print the argument with a “newline” at the end print(anything ) print the argument, but no “newline” println() print a newline. starts a new line printf(format-string , arguments ) print the arguments, using the format-string to format them. Java API documentation: The class, and where it belongs General description of the class List of methods (and constructors and fields) Details of the methods. Limitations of JOptionPane Fine for one value Not so good for lots o

文档评论(0)

l215322 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档