Search Header Logo
String Methods in Java

String Methods in Java

Assessment

Presentation

Computers

10th Grade

Medium

Created by

Lisa Donlan

Used 10+ times

FREE Resource

15 Slides • 10 Questions

1

media

2

media

3

media

4

media

5

Multiple Choice

What is the output?

String word1 = "Hello";

String word2 = "hello";

System.out.println(word1.equals(word2);

1

true

2

false

6

media

7

media

8

media

9

Multiple Choice

What is the output?

String word1 = "Day";

System.out.println(word1.length( ));

1

1

2

2

3

3

4

4

10

Multiple Choice

What is the output?

String word1 = "Day Old";

System.out.println(word1.length( ));

1

3

2

5

3

6

4

7

11

media

12

Multiple Choice

What is the output?

String word1 = "Happy Days";

System.out.println(word1.charAt(0);

1

D

2

H

3

Happy

4

Days

13

Multiple Choice

What is the output?

String word1 = "Happy Days";

System.out.println(word1.charAt(2);

1

H

2

a

3

p

4

y

14

media

15

media

16

media

17

Multiple Choice

What is the output?

String word1 = "Happy Days";

System.out.println(word1.substring(0,4);

1

Happy

2

Days

3

Hap

4

Happ

18

Multiple Choice

What is the output?

String word1 = "Happy Days";

System.out.println(word1.substring(4,9);

1

y Days

2

Day

3

Days

4

y Day

19

media

20

Multiple Choice

What is the ouput?

String word1 = "Hello";

String word2 = "hello";

System.out.println(word1.equals(word2);

System.out.println(word1.equalsIgnoreCase(word2);

1

true

true

2

true

false

3

false

true

4

false

false

21

media

String str = "class";

​What does str.length( ) equal?

22

media

String str = "class";

​What is the output?

23

Multiple Choice

What is the output?

String word1 = "stressful";

System.out.println(word1.substring(3));

1

essful

2

e

3

r

4

ressful

24

Overloading

substring(int) vs. substring(int, int)

This is an example of overloading. Java is smart enough to know that when you only use one integer, then give the rest of the string.

If you use two integers, then you are only getting part of the string.​

25

Open Ended

What are 3 things you learned today?

media

Show answer

Auto Play

Slide 1 / 25

SLIDE