Essential Java for AP CompSci: From Programming to Computer Science

  • 3h 5m
  • Doug Winnie
  • Apress
  • 2021

Gain the essential skills for computer science using one of today's most popular programming languages, Java. This book will prepare you for AP CompSci Complete, but you don’t need to be sitting that class to benefit. Computer science has become a basic life skill that everyone is going to need to learn. Whether you are going into a career or side hustle in business, technology, creativity, architecture, or almost any other field, you will find coding and computer science play a role.

So when we learn programming we are going to focus on three things: what is the process; what is the syntax; and what is the flow. The process is represented as a flowchart. We will learn how to make these to help you plan out what you are going to do before you write a line of code. At first, the flowcharts will be pretty simple, but then they will get more complex. The syntax is the code: this is what you write that translates the process you create in a flowchart to the instructions that the computer can understand. Finally, there is the flow. This is where you trace through the code and see how the data and information it stores along the way changes. You can see how the operation of the program cascades from line to line. You will be building charts that will capture the programming flow so you can better understand how the computer processes code to make your next program easier to conceive and code.

Along the way to aid in the learning of the essential Java skills, there will be three kinds of project types throughout this book: business software projects for applications where you work for a company and need to complete an internal project for a team such as the sales, marketing, or data science teams; social good projects where you are working for non-profits or for agencies that are trying to research and provide solutions to economic, environmental, medical, or humanitarian projects; and game development projects for games based on player input, random chance, or other mechanics for the use of entertainment.

What is unique about computer science is how it has become a skill, and not just a career. While there are jobs and titles of “computer scientist”, the skill of computer science, and specifically programming, are almost everywhere. After reading and using this book, you'll have the essential skills to think like a computer scientist, even if you are not. As a result you’ll be of greater value to your clients, your company, and yourself.

What You Will Learn

  • Discover the essential elements of Java to learn how to code like a computer scientist
  • Apply those elemental skills to a variety of project types drawn from business, social good, and game development
  • Flow chart your coding and software projects
  • Identify real-world metaphors to help reinforce computer science concepts and theories

Who This Book Is For

Those who want to learn programming and want to think like a computer scientist. Ideal for anyone taking AP CompSci Complete.

In this Book

  • Introduction
  • Setting Up the Java JDK and IntelliJ
  • Setting Up GitHub
  • Programming Languages
  • History and Uses of Java
  • How Java Works
  • Flowcharting
  • Hello, World
  • Simple Java Program Structure
  • Text Literals and Output
  • Value Literals
  • Output Formatting
  • Comments and Whitespace
  • Abstraction of Numbers
  • Binary
  • Unicode
  • Variables
  • Math!
  • Math Methods
  • Managing Type
  • Random Numbers
  • Capture Input
  • Creating Trace Tables
  • Methods
  • Calling Methods Within Methods
  • Methods and Values
  • Methods and Scope
  • Boolean Values and Equality
  • Simple Conditional Statements
  • Matching Conditions with the switch Statement
  • The Ternary Operator
  • The Stack and the Heap
  • Testing Equality with Strings
  • Dealing with Errors
  • Documenting with JavaDoc
  • Formatted Strings
  • The while Loop
  • Automatic Program Loops
  • The do/while Loop
  • Simplified Assignment Operators
  • The for Loop
  • Nesting Loops
  • Strings as Collections
  • Make Collections Using Arrays
  • Creating Arrays from Strings
  • Multidimensional Arrays
  • Looping Through Multidimensional Arrays
  • Beyond Arrays with ArrayLists
  • Introducing Generics
  • Looping with ArrayLists
  • Using for…each Loops
  • The Role-Playing Game Character
  • Polymorphism
  • Make All the Things…Classes
  • Class, Extend Thyself!
  • I don't Collect Those; Too Abstract
  • Access Denied: Protected and Private
  • Interfacing with Interfaces
  • All I'm Getting is Static
  • An All-Star Cast, Featuring Null