最新苏教版语文七年级上册文言文与古诗文复习习题下载.doc优秀名师资料.doc
《最新苏教版语文七年级上册文言文与古诗文复习习题下载.doc优秀名师资料.doc》由会员分享,可在线阅读,更多相关《最新苏教版语文七年级上册文言文与古诗文复习习题下载.doc优秀名师资料.doc(41页珍藏版)》请在三一文库上搜索。
1、苏教版语文七年级上册文言文与古诗文复习习题(免费下载).docChapter 9 Strings and Text I/O1Motivations2Objectives3The String Class4Constructing Strings5Strings Are Immutable6animationTrace CodeString s = Java;s = HTML;After executing s = HTML; After executing String s = Java; s : String This string object is : String s now unre
2、ferenced String object for Java String object for Java : String Contents cannot be changed String object for HTML 7animationTrace CodeString s = Java;s = HTML;After executing s = HTML; After executing String s = Java; s : String This string object is : String s now unreferenced String object for Jav
3、a String object for Java : String Contents cannot be changed String object for HTML 8Interned Strings9Exampless1 String s1 = Welcome to Java; : String s3 Interned string object for String s2 = new String(Welcome to Java); Welcome to Java String s3 = Welcome to Java; s2 : String System.out.println(s1
4、 = s2 is + (s1 = s2); System.out.println(s1 = s3 is + (s1 = s3); A string object for Welcome to Java 10animationTrace Codes1 String s1 = Welcome to Java; : String Interned string object for String s2 = new String(Welcome to Java); Welcome to Java String s3 = Welcome to Java; 11Trace Codes1 String s1
5、 = Welcome to Java; : String Interned string object for String s2 = new String(Welcome to Java); Welcome to Java String s3 = Welcome to Java; s2 : String A string object for Welcome to Java 12Trace Codes1 String s1 = Welcome to Java; : String s3 Interned string object for String s2 = new String(Welc
6、ome to Java); Welcome to Java String s3 = Welcome to Java; s2 : String A string object for Welcome to Java 13String Comparisonsjava.lang.String +equals(s1: String): boolean Returns true if this string is equal to string s1. +equalsIgnoreCase(s1: String): Returns true if this string is equal to strin
7、g s1 case-boolean insensitive. +compareTo(s1: String): int Returns an integer greater than 0, equal to 0, or less than 0 to indicate whether this string is greater than, equal to, or less than s1. +compareToIgnoreCase(s1: String): Same as compareTo except that the comparison is case-int insensitive.
8、 +regionMatches(toffset: int, s1: String, Returns true if the specified subregion of this string exactly offset: int, len: int): boolean matches the specified subregion in string s1. +regionMatches(ignoreCase: boolean, Same as the preceding method except that you can specify toffset: int, s1: String
9、, offset: int, whether the match is case-sensitive. len: int): boolean +startsWith(prefix: String): boolean Returns true if this string starts with the specified prefix. +endsWith(suffix: String): boolean Returns true if this string ends with the specified suffix. 14String Comparisons15String Compar
10、isons, cont.16String Length, Characters, and Combining Strings java.lang.String Returns the number of characters in this string. +length(): int Returns the character at the specified index from this string. +charAt(index: int): char Returns a new string that concatenate this string with string s1. +
11、concat(s1: String): String string. 17Finding String Length18Retrieving Individual Characters in a String0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Indices W e l c o m e t o J a v a message message.charAt(0) message.length() is 15 message.charAt(14) 19String Concatenation20Extracting Substringsjava.lang.Stri
12、ng Returns this strings substring that begins with the character at the +subString(beginIndex: int): specified beginIndex and extends to the end of the string, as String shown in Figure 8.6. +subString(beginIndex: int, Returns this strings substring that begins at the specified endIndex: int): Strin
13、g beginIndex and extends to the character at index endIndex 1, as shown in Figure 8.6. Note that the character at endIndex is not part of the substring. 21Extracting Substrings0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Indices W e l c o m e t o J a v a message message.substring(0, 11) message.substring(11)
14、22Converting, Replacing, and Splitting Strings java.lang.String +toLowerCase(): String Returns a new string with all characters converted to lowercase. +toUpperCase(): String Returns a new string with all characters converted to uppercase. +trim(): String Returns a new string with blank characters t
15、rimmed on both sides. +replace(oldChar: char, Returns a new string that replaces all matching character in this newChar: char): String string with the new character. +replaceFirst(oldString: String, Returns a new string that replaces the first matching substring in newString: String): String this st
16、ring with the new substring. +replaceAll(oldString: String, Returns a new string that replace all matching substrings in this newString: String): String string with the new substring. +split(delimiter: String): Returns an array of strings consisting of the substrings split by the String delimiter. 2
17、3Examples24Splitting a StringString tokens = Java#HTML#Perl.split(#, 0);for (int i = 0; i tokens.length; i+) System.out.print(tokensi + );25Matching, Replacing and Splitting by Patterns 26Matching, Replacing and Splitting by Patterns 27Matching, Replacing and Splitting by Patterns 28Finding a Charac
18、ter or a Substring in a Stringjava.lang.String Returns the index of the first occurrence of ch in the string. +indexOf(ch: char): int Returns -1 if not matched. +indexOf(ch: char, fromIndex: Returns the index of the first occurrence of ch after fromIndex in int): int the string. Returns -1 if not ma
19、tched. +indexOf(s: String): int Returns the index of the first occurrence of string s in this string. Returns -1 if not matched. +indexOf(s: String, fromIndex: Returns the index of the first occurrence of string s in this string int): int after fromIndex. Returns -1 if not matched. +lastIndexOf(ch:
20、int): int Returns the index of the last occurrence of ch in the string. Returns -1 if not matched. +lastIndexOf(ch: int, Returns the index of the last occurrence of ch before fromIndex fromIndex: int): int in this string. Returns -1 if not matched. +lastIndexOf(s: String): int Returns the index of t
21、he last occurrence of string s. Returns -1 if not matched. +lastIndexOf(s: String, Returns the index of the last occurrence of string s before fromIndex: int): int fromIndex. Returns -1 if not matched. 29Finding a Character or a Substring in a String30Convert Character and Numbers to Strings31Proble
22、m: Finding PalindromesCheckPalindromeCheckPalindromeRun32The Character Classjava.lang.Character +Character(value: char) Constructs a character object with char value +charValue(): char Returns the char value from this object +compareTo(anotherCharacter: Character): int Compares this character with a
23、nother +equals(anotherCharacter: Character): boolean Returns true if this character equals to another +isDigit(ch: char): boolean Returns true if the specified character is a digit +isLetter(ch: char): boolean Returns true if the specified character is a letter +isLetterOrDigit(ch: char): boolean Re
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 最新 苏教版 语文 年级 上册 文言文 古诗文 复习 习题 下载 amp 46 doc 优秀 名师 资料
链接地址:https://www.31doc.com/p-1511531.html