- 1、本文档共28页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 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 ScannerOutput Using DrawingCanvasCOMP 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 getinput 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
您可能关注的文档
最近下载
- 2024年全国版图知识竞赛(中小学组)试题汇总(附解析).doc
- JBT 10692-2018 变压器用油位计.pdf
- 2024年(新高考I卷)英语试题说明+全文译文+解析-学生版.pdf VIP
- 小学三年级上册书法练习指导全册教案.doc
- 《中国慢性肾脏病患者血钾管理实践专家共识(2020)》解读.pptx VIP
- 东风雷诺dCi11发动机构造、气门调整讲解.pdf VIP
- 18G901-1图集—混凝土结构施工钢筋排布规则与构造详图(现浇混凝土框架、剪力墙、梁、板).pdf
- 部编版语文四年级下册第七单元、第八单元复习课教案和过关检测题(共2套).doc
- 2021新版食品安全法培训.ppt课件【完整版】.pdf VIP
- 《符号调节工具(-1)的n次方》.pptx
文档评论(0)