
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Various properties and methods of java strings, including treating strings as single units, creating strings from character arrays, determining string length, accessing characters, comparing strings, and manipulating strings using methods like substring, concat, valueof, stringbuffer, scanner, and stringtokenizer.
Typology: Quizzes
1 / 1
This page cannot be seen from the preview
Don't miss anything!

1. Is string series of characters treated as single unit? a. TRUE 2. Class string represent characters in java .... False 3. char charArray[] = { 'b', 'i', 'r', 't', 'h', ' ', 'd', 'a', 'y' }; String s4 = new String( charArray, 6, 3 ); a. s4=”day” 4. Method length determines the length of a String a. TRUE 5. Method charAt Get character at specific location in String 6. Method equals tests two objects for equality using lexicographical comparison a. TRUE 7. Method startsWith determines if String starts with specified characters a. TRUE 8. Method indexOf finds last occurrence of character in String a. FALSE 9. String letters = "abcdefghijklmabcdefghijklm"; letters.substring( 20 ) ); a. Hijklm 10. String s1 = new String( "Happy " ); String s2 = new String( "Birthday" ); s1.concat( s2 ) a. Happy Birthday 11. Method valueOf returns String representation of object, data, etc. a. TRUE 12. StringBuffer buffer2 = new StringBuffer( 10 ); System.out.printf( "buffer2 = "%s"\n", buffer2.toString() ); a. buffer2 = "" 13. method append Allow data values to be added to StringBuffer 14. Method insert Allows data-type values to be inserted into StringBuffer 15. Scanner scanner = new Scanner( System.in ); scans the input from console a. True 16. java.util.StringTokenizer Partition String into individual substrings 17. String method replaceAll replaces the first occurrence of a pattern match a. FALSE