Published using Google Docs
APCS-CH2-Notes-2-Master
Updated automatically every 5 minutes

AP Computer Science

Chapter 2 Notes-Set 2

Strings, Variables and Assignment, and Primitive Data Types

Strings


                                                                        Output and Notes

Escape Sequences


                                                                                Output and Notes

Variables


                                                                                Output and Notes

Variable Assignment


                                                                        Output and Notes

Constants



Primitive Data Types


There are exactly eight primitive data types in Java

Four of them represent integers:

Two of them represent floating point numbers:

One of them represents characters:

And one of them represents boolean values:

Only three are in the AP subset: int, double, and boolean

Arithmetic Expressions


Addition                        +

Subtraction                        -

Multiplication                *

Division                        /

Remainder                        %


                                                                        Output and Notes:

Data Conversions


result = (double) total / count

                

Enumerated Types


                                                                        Output and Notes