- 1、本文档共64页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
java程序计jhtp5_02
Chapter 2 - Introduction to Java Applications 2.1 Introduction In this chapter Introduce examples to illustrate features of Java Two program styles - applications and applets 2.2 A First Program in Java: Printing a Line of Text Application Program that executes using the java interpreter Sample program Show program, then analyze each line Welcome1.javaProgram Output 1 // Fig. 2.1: Welcome1.java 2 // Text-printing program. 3 4 public class Welcome1 { 5 6 // main method begins execution of Java application 7 public static void main( String args[] ) 8 { 9 System.out.println( Welcome to Java Programming! ); 10 11 } // end method main 12 13 } // end class Welcome1 2.2 A First Program in Java: Printing a Line of Text Comments start with: // Comments ignored during program execution Document and describe code Provides code readability Traditional comments: /* ... */ /* This is a traditional comment. It can be split over many lines */ Another line of comments Note: line numbers not part of program, added for reference 2.2 A Simple Program: Printing a Line of Text Blank line Makes program more readable Blank lines, spaces, and tabs are white-space characters Ignored by compiler Begins class declaration for class Welcome1 Every Java program has at least one user-defined class Keyword: words reserved for use by Java class keyword followed by class name Naming classes: capitalize every word SampleClassName 2.2 A Simple Program: Printing a Line of Text Name of class called identifier Series of characters consisting of letters, digits, underscores ( _ ) and dollar signs ( $ ) Does not begin with a digit, has no spaces Examples: Welcome1, $value, _value, button7 7button is invalid Java is case sensitive (capitalization matters) a1 and A1 are different For chapters 2 to 7, use public keyword Certain details not important now Mimic certain features, discussions later 2.2
您可能关注的文档
最近下载
- 结直肠肿瘤手术治疗.ppt VIP
- 小学数学新西师版一年级上册第三单元《认识立体图形》第2课时教学课件(2024秋).pptx
- 2024年天津市专业技术人员继续教育公需课考试题+答案(四套全).pdf VIP
- 2023年二级造价工程师真题答案及解析(重庆).pdf VIP
- 2024中心静脉导管冲管及封管专家共识 .pdf VIP
- Grundfos格兰富S系列潜水泵S pumps, ranges 72-74-78, S2, S3, S4, ST, 55 - 520 kW (I & O instructions)安装及运行维护指导手册.pdf
- 贯彻新发展理念不够到位总结.pdf VIP
- 预防校园欺凌主题教育国旗下讲话(10篇).pdf VIP
- 围绕中心服务大局推动全县卫生系统党建工作再上新台阶.pdf VIP
- 建立党员激励、关怀、帮扶机制.pdf VIP
文档评论(0)