
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
10 questions
Absolute Value Equations
Presentation
•
9th - 12th Grade
9 questions
Spanish Demonstrative Adjectives
Presentation
•
9th - 12th Grade
12 questions
3A Gramática : -ER and -IR regular verbs
Presentation
•
KG - 12th Grade
10 questions
UEFI
Presentation
•
9th - 12th Grade
11 questions
Quadrilaterals
Presentation
•
9th - 12th Grade
10 questions
Parallel Structure
Presentation
•
10th - 12th Grade
10 questions
Distracted Driving
Presentation
•
10th - 12th Grade
10 questions
GESTIONANDO LMS
Presentation
•
KG
Popular Resources on Wayground
24 questions
PBIS-HGMS Day 10
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Review 3
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
15 questions
HCS SCI 05 Summer School Assessment 3 Review
Quiz
•
5th Grade
35 questions
Lufkin Road Middle School Student Handbook & Policies Assessment
Quiz
•
7th Grade
18 questions
Geo 11.3 Area of Circles and Sectors
Quiz
•
9th - 11th Grade