<< Chapter < Page Chapter >> Page >
This lesson explains several of the pitfalls awaiting the unsuspecting Java programming student using the arithmetic operators.

Table of contents

Preface

General

This tutorial lesson is part of a series of lessons dedicated to the AP Computer Science A Exam .

The purpose of the series is to help you to better understand some of the material that you will find on the website that provides information for theexam.

For example, if you access the AP Computer Science Course Description and scroll down to Appendix A titled AP Computer Science Java Subset , you will find the following specification :

2. Arithmetic operators: +, -, *, /, % are part of the AP Java subset.

(Note: This is the wording that appeared on the website on March 1, 2011. It may change over time.)

May be clear to some, but not to others

While some students and their homeschool parents may know exactly what is meant by this text, others may not. Therefore, my objective will be toelaborate on and attempt to clarify such specifications from a technical viewpoint to help those students and their parents get a better understanding of where they need toconcentrate their efforts.

In this lesson, I will provide program code that illustrates some of what the student is expected to know about the arithmetic operators.

Viewing tip

I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the figuresand listings while you are reading about them.

Figures

Listings

Supplemental material

I recommend that you also study the other lessons in my extensive collection of online programming tutorials. You will find a consolidated index at www.DickBaldwin.com .

Discussion and sample code

According to Sun's Summary of Operators website , the Java arithmetic operators are shown in Figure 1.

Figure 1 . Arithmetic Operators.

+ Additive operator (also used for String concatenation)

- Subtraction operator

* Multiplication operator

/ Division operator

% Remainder operator

Five arithmetic operators

If you compare Figure 1 with the specification , you will see that all of the arithmetic operators are included in the Javasubset. Unlike the case for primitive variables discussed in an earlier lesson, none of the arithmetic operators are excluded from the subset.Therefore, the student is expected to understand how to use all of the arithmetic operators in order to successfully complete the exam.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Ap computer science a, clarification of the java subset. OpenStax CNX. Oct 03, 2015 Download for free at https://legacy.cnx.org/content/col11279/1.5
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ap computer science a, clarification of the java subset' conversation and receive update notifications?

Ask