Computer Math - Strings

Ace your homework & exams now with Quizwiz!

String one = "abcdefghijklm"; System.out.print( one.charAt(0) );

a

charAt(): a). x >= 0 b). x > 0

a

indexOf(): a). x >= 0 b). x > 0

a

String one = "abcdefghijklm"; System.out.print( one.substring(0,4) );

abcd

String one = "abcdefghijklm"; System.out.print( one.charAt(1));

b

length(): a). x >= 0 b). x > 0

b

String one = "abcdefghijklm"; System.out.print( one.substring(2,7));

cdefg

String one = "abcdefghijklm"; System.out.print( one.charAt(9) );

j

String one = "abcdefghijklm"; System.out.print( one.substring(9) );

jklm

String one = "abcdefghijklm"; System.out.print(one.charAt(one.length()-1));

m

String two = "01234567890"; System.out.print( two.indexOf("24"));

-1

String two = "01234567890"; System.out.print( two.indexOf('r'));

-1

String one = "abcdefghijklm"; System.out.print( one.indexOf("abc") );

0

String two = "01234567890"; System.out.print( two.indexOf('0'));

0

String two = "01234567890"; System.out.print( two.length());

11

String one = "abcdefghijklm"; System.out.print(one.length());

13

String three = "01 23 45 67 89 0"; System.out.print( three.length());

16

String one = "abcdefghijklm"; System.out.print( one.indexOf('c'));

2

String one = "abcdefghijklm"; System.out.print( one.indexOf("e") );

4

String two = "01234567890"; System.out.print( two.indexOf("56"));

5

String three = "01 23 45 67 89 0"; System.out.print( three.indexOf("45"));

6

String one = "abcdefghijklm"; System.out.print( one.indexOf("hij") );

7

String one = "abcdefghijklm"; System.out.print( one.substring(5) );

fghijklm

public char getFirstLetter( ) { }

return word.charAt(0);

public char getLastLetter( ) { }

return word.charAt(word.length()-1);

public String toString()

return word;

public LetterFun(String s) { }

setString(s);

public void setString(String s) { }

word = s;


Related study sets

PADI, Open Water Diver, Final Exam Review

View Set

Chapter 5: Individual Life Insurance Contract: Provisions and Options

View Set

Chapter 9. Performance Management

View Set

Ch. 24 - Fitness and Therapeutic Exercise

View Set