- 1
- 0
- 约1.85万字
- 约 49页
- 2019-05-06 发布于广东
- 举报
* Introduction to Java Programming Chapter 2 - * 2.15 The String Type The char type only represents one character. To represent a string of characters, use the data type called String. For example, ? String message = Welcome to Java; ? String is actually a predefined class in the Java library just like the System class and JOptionPane class. The String type is not a primitive type. It is known as a reference type. Any Java class can be used as a reference type for a variable. Reference data types will be thoroughly discussed in Chapter 6, “Classes and Objects.” For the time being, you just need to know how to declare a String variable, how to assign a string to the variable, and how to concatenate strings. * Introduction to Java Programming Chapter 2 - * String Concatenation // Three strings are concatenated String message = Welcome + to + Java; ? // String Chapter is concatenated with number 2 String s = Chapter + 2; // s becomes Chapter2 ? // String Supplement is concatenated with character B String s1 = Supplement + B; // s becomes SupplementB * Introduction to Java Programming Chapter 2 - * 2.16 Programming Style and Documentation Appropriate Comments Naming Conventions Proper Indentation and Spacing Lines Block Styles * Introduction to Java Programming Chapter 2 - * Appropriate Comments Include a summary at the beginning of the program to explain what the program does, its key features, its supporting data structures, and any unique techniques it uses. Include your name, class section, instructor, date, and a brief description at the beginning of the program. * Introduction to Java Programming Chapter 2 - * Naming Conventions Choose meaningful and descriptive names. Variables and method names: Use lowercase. If the name consists of several words, concatenate all in one, use lowercase for the first word, and capitalize the first letter of each subsequent word in the name. For example, the variables radius and area, and the method computeArea. * Intro
您可能关注的文档
- 东北农业大学经济管理学院现代企业管理课件 第五章.ppt
- 东北农业大学经济管理学院现代企业管理课件 第一章.ppt
- 东北农业大学农业电气化与自动化课件 电子技术 CHAPTER2.PPT
- 东北农业大学农业电气化与自动化课件 电子技术 CHAPTER7.PPT
- 东北农业大学农业电气化与自动化课件 电子技术 CHAPTER8.PPT
- 东北农业大学农业电气化与自动化课件 电子技术 chapter11.ppt
- 东北农业大学农业电气化与自动化课件 电子技术 chapter12.ppt
- 东北农业大学农业电气化与自动化课件 电子技术 CHAPTER14.PPT
- 东北农业大学农业电气化与自动化课件 电子技术 chapter17.ppt
- 东北农业大学农业电气化与自动化课件 电子技术 chapter19.ppt
- 福建农林大学计算机与信息学院JAVA语言程序设计课件Chapter8 Objects and Classes.ppt
- 福建农林大学计算机与信息学院JAVA语言程序设计课件Chapter9 Strings and Text I-O.ppt
- 福建农林大学计算机与信息学院JAVA语言程序设计课件Chapter11 Inheritance and Polymorphism.ppt
- 福建农林大学计算机与信息学院JAVA语言程序设计课件Chapter14 Abstract Classes and Interfaces.ppt
- 福建农林大学计算机与信息学院JAVA语言程序设计课件Chapter16 Event-Driven Programming.ppt
- 福建农林大学交通与土木工程学院混凝土结构设计原理课件第2章 混凝土结构材料的物理力学性能.ppt
- 福建农林大学交通与土木工程学院混凝土结构设计原理课件第3章 混凝土结构设计的基本原则.ppt
- 福建农林大学交通与土木工程学院混凝土结构设计原理课件第8章 受扭构件承载力计算.ppt
- 福建农林大学交通与土木工程学院混凝土结构设计原理课件第10章 正常使用极限状态验算及耐久性设计.ppt
- 福建农林大学交通与土木工程学院土力学课件 地基承载力.ppt
原创力文档

文档评论(0)