
STRING CLASS
Presentation
•
Other
•
12th Grade
•
Practice Problem
•
Easy
Ana Dupla
Used 4+ times
FREE Resource
70 Slides • 5 Questions
1
11 ICT
2
and PROGRAM STYLE
3
Answer the questions by arranging the line of code/s to get the output or correct a simple line of code.
Please also check if the CASING is right.
4
Open Ended
Arrange the given line of code:
public static main String ([] args)
5
Open Ended
Arrange and/or change the given line of code to make it correct. (if you think there is a missing part, add it to the program code)
int = myInteger 2.0
6
Open Ended
Arrange and/or change the given line of code to make it correct. (if you think there is a missing part, add it to the program code)
System.Print('HelloWorld')
7
Open Ended
What is the output?
public class Multiply{
public static void main (String [] args)
double y=10*1+10;
System.out.println(z)}}
8
Open Ended
Arrange the 3rd line of code to make it correct:
public class Multiply{
public static void main (String [] args){
double y=10*1+10;
System.out.println(z);}}
9
When do we normally use " " and ' ' ?
10
In language: direct quotes, dialogue, titles of short works, the emphasis of certain words, and separating nicknames from given names.
In programming?
" "
11
In language: used to replace double quotation marks when they’re inside of other double quotation marks
In programming?
' '
12
13
Be READY to answer during our discussion!
You can click the buzzer when you're done typing the correct answer.
14
Can you use " " inside another " "?
15
Can you use " " inside another " "?
16
YES
17
\” = Double Quote
\’ = Single Quote
\\ = Backslash
\n = New line (beginning of the next line)
\r = Carriage return (beginning of the current line)
\t = Tab
18
-String
-Used to store and process strings of characters.
-When used to declare: String VariableName;
-Use of double quotation “ ”.
-The quoted string is a value of type String.
19
Type a line of code for displaying/printing/result:
"Hello ICT!"
NOTE: Just a single line for printing/displaying the output.
20
System.out.println(“\"Hello ICT!\"”);
21
Declare Food to be the name of the String Variable
Set the value of Food as "Chicken and Pork Adobo"
How will you write it using Java Syntax/code?
NOTE: Just a single line for declaring variable.
22
+ sign becomes or sometimes called concatenation operator
When you use the + operator on two strings, the result is the string obtained by connecting the two strings to get a longer string.
23
Can we use concatenation when combining a variable and a string?
24
Can we use concatenation when combining a variable and a string?
25
YES
26
String sentence;
sentence = noun + “are cool.”;
System.out.println(sentence);
What is the output?
27
String sentence;
sentence = noun + “are cool.”;
System.out.println(sentence);
28
Stringsare cool
29
System.out.println(“100” + 42);
System.out.println(100 + 42);
What is the output?
30
10042
142
31
are entities that store data and can take actions.
Objects
the name for a type whose values are objects.
Class
the information in parenthesis
Argument
the actions that an object can take.
Methods
called sending a message to the object.
Invoking a method
32
A string method is called (invoked) by writing a String object, a dot, the name of the method, and finally a pair of parenthesis that enclose any arguments to the method.
33
String greeting = “Hello”;
//int count = greeting.length();
System.out.println(“Length is ” + greeting.length());
What is the output?
34
//int count = greeting.length();
System.out.println(“Length is ” + greeting.length());
35
Length is 5
36
37
returns the length of the calling object (which is a string) as a value of type int.
38
Example:
String greeting = “Hello ”;
greeting.length() displays ?
Output:
39
Example:
String greeting = “Hello ”;
greeting.length() displays ?
Output:
6
40
returns true if the calling object string and the Other_String are equal. Otherwise, returns false.
41
Example:
String greeting = “Hello”;
greeting.equals(“Hello”) returns ?
greeting.equals(“hello”) returns ?
greeting.equals(“Goodbye”) returns ?
Output:
?
?
?
42
Example:
String greeting = “Hello”;
greeting.equals(“Hello”) returns ?
greeting.equals(“hello”) returns ?
greeting.equals(“Goodbye”) returns ?
Output:
TRUE
FALSE
FALSE
43
returns true if the calling object string and the Other_String are equal, considering uppercase and lowercase versions of a letter to be the same. Otherwise, returns false.
44
Example:
String greeting = “mary! ”;
greeting.equalsIgnoreCase("Mary!") returns?
Output:
45
Example:
String greeting = “mary! ”;
greeting.equalsIgnoreCase("Mary!")
Output:
True
46
returns a string with the same characters as the calling object string, but with all letter characters converted to lowercase.
47
Example:
String greeting = “Hi Mary! ”;
greeting.toLowerCase() returns?
Output:
48
Example:
String greeting = “Hi Mary! ”;
greeting.toLowerCase() returns?
Output:
hi mary!
49
returns a string with the same characters as the calling object string, but with all letter characters converted to uppercase.
50
Example:
String greeting = “Hi Mary! ”;
greeting.toUpperCase() returns?
Output:
51
Example:
String greeting = “Hi Mary! ”;
greeting.toUpperCase() returns?
Output:
HI MARY!
52
returns a string with the same characters as the calling object string, but with leading and trailing white space removed.
white space-blank space, tab, new line
53
Example:
String pause = “ Hmm ”;
pause.trim() returns ?
Output:
54
Example:
String pause = “ Hmm ”;
pause.trim() returns ?
Output:
Hmm
55
returns the character in the calling object string at the Position.
Position are counted 0, 1, 2, etc.
56
Example:
String greeting = “Hello!”;
greeting.charAt(0) returns ?
greeting.charAt(1) returns ?
Output:
57
Example:
String greeting = “Hello!”;
greeting.charAt(0) returns ?
greeting.charAt(1) returns ?
Output: H
e
58
returns the substring of the calling object string starting from position Start through to the end of the calling object.
59
Example:
String sample = “AbcdefG”;
sample.substring(2) returns ?
Output:
60
Example:
String sample = “AbcdefG”;
sample.substring(2) returns ?
Output:
cdefG
61
returns the substring of the calling object string starting from position Start through but not including, position End of the calling object.
62
Example:
String sample = “AbcdefG”;
sample.substring(2, 5) returns ?
Output:
63
Example:
String sample = “AbcdefG”;
sample.substring(2, 5) returns ?
Output:
cde
64
returns the index (position) of the first occurrence of the string A_String in the calling object string. Returns -1 if A_String is not found.
65
Example:
String greeting = “Hi Mary!”;
greeting.indexOf("Mary") returns ?
greeting.indexOf("Sally") returns ?
Output:
66
Example:
String greeting = “Hi Mary!”;
greeting.indexOf("Mary") returns ?
greeting.indexOf("Sally") returns ?
Output: 3
-1
67
returns the index (position) of the last occurrence of the string A_String in the calling object string. Returns -1 if A_String is not found.
68
Example:
String greeting = “Mary, Mary, Mary you are sweet”;
greeting.indexOf("Mary") returns ?
greeting.lastIndexOf("Mary") returns ?
Output:
0
12
69
int length()
boolean equals(other_string)
boolean equalsIgnoreCase(other_string)
String toLowerCase()
String toUpperCase()
String trim()
70
char charAt(position)
String substring(Start)
String substring(Start, End)
int indexOf(A_String)
int lastIndexOf(A_String)
71
Check our activity there. Submit your output.
A student will explain the answer in class.
72
Two ways to insert comment:
//comment and /* comment */
Line comments // (for comments meant only for the code writer or for programmers who modifies the code.
Block comments /* */ (for line breaks and documentation)
73
GENERAL RULE: easy to understand and easy to follow.
74
75
PERFORMANCE TASK AND WRITTEN ACTIVITY
11 ICT
Show answer
Auto Play
Slide 1 / 75
SLIDE
Similar Resources on Wayground
70 questions
Acid Base Balances and Imbalances
Presentation
•
University
71 questions
¡Vivan las vitaminas!
Presentation
•
10th - 12th Grade
69 questions
1 Hardware and Software
Presentation
•
11th Grade
67 questions
Unit 7 Test Review
Presentation
•
11th Grade
74 questions
Unit 4 Comprehensive Review
Presentation
•
University
70 questions
Managerial Accounting
Presentation
•
12th Grade
61 questions
Penanganan Barang bawaan Tamu
Presentation
•
12th Grade
Popular Resources on Wayground
10 questions
Safety Day 2026 – Student Review
Quiz
•
9th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
12 questions
Map Skills
Quiz
•
3rd Grade
22 questions
Continents and Oceans
Quiz
•
5th Grade
15 questions
Rounding Decimals
Quiz
•
5th Grade
Discover more resources for Other
26 questions
SLIME!!!!!
Quiz
•
KG - 12th Grade
21 questions
Los paises hispanohablantes y sus capitales
Quiz
•
12th Grade
20 questions
Cell Transport
Quiz
•
9th - 12th Grade
20 questions
Budgeting
Quiz
•
9th - 12th Grade
20 questions
Investing
Quiz
•
9th - 12th Grade
8 questions
DNA vs. RNA
Presentation
•
9th - 12th Grade
12 questions
Identify Rigid Transformations
Quiz
•
8th - 12th Grade
10 questions
Complementary, Supplementary, Vertical, and Linear Pairs
Quiz
•
9th - 12th Grade