<< Chapter < Page Chapter >> Page >
This lesson discusses the ramifications of types short, long, byte, char, and float not being included in the Java subset for the AP Computer Science A exam.

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 the Java Subset specifications for the Advanced Placement Computer Science A exam.

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 :

1. The primitive types int, double, and boolean are part of the AP Java subset.

The other primitive types short, long, byte, char, and float are not in the subset.

In particular, students need not be aware that strings are composed of char values. Introducing char does not increase the expressiveness of the subset.

Students already need to understand string concatenation, String.substring, and String.equals. (This is a requirement in a different part of the course description .)

Not introducing char avoids complexities with the char/int conversions and confusion between "x" and 'x'.

(Note that I inserted some explanatory text in parentheses and also inserted some line breaks for clarity. Also note that this is the wordingthat 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 to elaborateon and attempt to clarify such specifications from a technical viewpoint to help those students and their parents get a better understanding of where they needto concentrate their efforts.

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 figureswhile you are reading about them.

  • Figure 1 . Calculating the number of cans of paint to purchase.
  • Figure 2 . Value ranges for integer types.
  • Figure 3 . Representing a large range of values.
  • Figure 4 . Value range for floating-point types.

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

Java, C++, C#, and some other modern programming languages make heavy use of a concept that we refer to as type, or data type. We refer to those languages as strongly typed or type-sensitive languages.

Not all languages are type-sensitive languages. In particular, some languages hide the concept of type from the programmer and automatically deal with type issues behind the scenes.

Different types of data

Type-sensitive programming languages deal explicitly with different types of data. Some data types involve whole-numbers only (no fractional parts are allowed) . We generally refer to these as integer types.

Get the best College algebra course in your pocket!





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