
Strings and Class Type
Presentation
•
Computers
•
10th - 12th Grade
•
Medium
Alexandra Ulrich
Used 18+ times
FREE Resource
8 Slides • 5 Questions
1
Strings and Class Type
AP CSA

2
Class data types are capitalized, and primitive data types are not
Primitive data types only hold one piece of data at a time
3
Multiple Choice
int x=15; is :
primitive type
class type
4
Multiple Choice
True or False: Variables of class data types do not always have to hold a memory location all the time
True
False
5
When a group of statements, including control structures are assembled into a single unit, the unit is called a class
Naming conventions are similar to those of a variable but a class should begin with a capital letter and reference the purpose of the class.
public class GradePointAvg
{
// statements not shown
}
6
Multiple Choice
Which of the following class declarations would cause a compile-time error? Assume the rest of the code compiles as intended.
public class Science
public class apScience
public class APScience
public class 4APScience
public class APScience extends Science
7
A Java string is a series of characters gathered together, like the word "Hello", or the phrase The expert in anything was once a beginner — Helen Hayes.
8
The standard way to create a new object of a class in Java:
greeting = new String("Hello");
You can also use just a string literal, which is a set of characters enclosed in double quotes ("), to create a String object.
greeting = "Hello";
9
Strings can be appended to each other to create a new string using the + or += operator .
This is also called concatenation.
String start = "Happy Birthday";
String name = "Jose";
String result = start + " " + name; // add together strings
10
Multiple Choice
Which of the following statements use string literal?
System.out.print(side1);
System.out.print("side1");
11
Numerical values can be printed to the screen for output
Example: If a triangle has a side length of 2 stored in memory using identifies side1 and you eant to ouput that information to the screen you could use either:
System.out.print(2);
System.out.print(side1): //will display the value stored using the side1 identifier
System.out.print("side 1") // will display
12
Multiple Choice
Assuming all other statements in the program are correct, each of the following statements will allow the program to compile EXCEPT:
System.out.print(2);
System.out.print("2");
System.out.print(side1);
System.out.print("side1");
13
Don't forget to look at activites on coding bat for addtional practice.
(6 min)
https://codingbat.com/doc/java-string-introduction.html
https://youtu.be/xqFGn5P1Ho8
Strings and Class Type
AP CSA

Show answer
Auto Play
Slide 1 / 13
SLIDE
Similar Resources on Wayground
9 questions
Domain 1 - Lesson 3: Configure Drive Encryption
Presentation
•
9th - 12th Grade
10 questions
Basic HTML ;>
Presentation
•
10th - 12th Grade
11 questions
Teenager 5 Session 24: Pronunciation & Speaking
Presentation
•
KG
11 questions
Significant Figures
Presentation
•
10th - 12th Grade
10 questions
Operators in Python
Presentation
•
9th - 12th Grade
7 questions
Synonyms and Antonyms
Presentation
•
10th - 12th Grade
10 questions
Domain 2 Lesson 3
Presentation
•
9th - 12th Grade
10 questions
FIRST CONDITIONAL (review)
Presentation
•
10th - 11th Grade
Popular Resources on Wayground
10 questions
5.P.1.3 Distance/Time Graphs
Quiz
•
5th Grade
10 questions
Fire Drill
Quiz
•
2nd - 5th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
15 questions
Hargrett House Quiz: Community & Service
Quiz
•
5th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade