top of page

AP Compupter Science A : Primitive Types

By Atina Lee


In the course of AP Computer Science, primitive types or the basic data types of Java are one of the most important lessons you must understand as it is the fundamentals of the language. Here are the 8 primitive types: boolean, byte, character, short, int, long, float, and double. In this blog, we will be focusing on boolean, int, and double.


Booleans

In Java, booleans are a data type that only takes 2 answers: True or False. They are mostly used for comparing items or using conditional testing. In the AP Computer Science A course you will be expected to use booleans to create and write code. Here is some an example of how to declare a boolean:

boolean comparison = True


Int (Integer)/Double

As you may have guessed, Int in Java and many other coding languages stands for integer. Simply said, int are counting numbers while doubles are decimals are floating-point numbers. For this exercise below, identify each number as a double or an int.


3 5.4 3.4 823 .003 300


In Java, you can do a lot with integers and doubles. It is very essential to the curriculum along with the knowledge of booleans. Here is an ending activity for you to practice. How would you add 2 integers together?


 
 
 

Recent Posts

See All
An Introduction to Genetics

By Narayani Shankar What is Genetics? Genetics, the study of genes and heredity, is a field that seems to be rapidly advancing in...

 
 
 
Dall-E 3 and Generative AI

By Emily Huang DALL-E 3: Bridging Text and Image with AI Artistry “DALL-E 3 understands significantly more nuance and detail than our...

 
 
 

Comentarios


Stem (1)-fotor-bg-remover-20230319203532.png

STEMBRIDGEINC is a 501(c)(3) non-profit organization bridging the gender gap in computer science and STEM by empowering and inspiring future female leaders through student-led events and resources.

copyright-symbol_edited.jpg

All Rights Reserved 

  • Instagram
  • Linkedin
bottom of page