This community-built FAQ covers the “booleans” exercise from the lesson “Learn Java: Variables”.

**Paths and Courses**

This exercise can be found in the following Codecademy content:

Learn Java

## FAQs on the exercise *booleans*

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. **Ask or answer a question by clicking ***reply* () below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

## Join the Discussion. Help a fellow learner on their journey.

**Ask or answer a question** about this exercise by clicking **reply** () below!

Agree with a comment or answer? **Like** () to up-vote the contribution!

Need **broader help or resources**? Head here.

Looking for motivation to keep learning? Join our **wider discussions**.

**Learn more** about how to use this guide.

Found a **bug**? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Create a variable called `intsCanHoldDecimals`

. Set it to `true`

if the `int`

type can hold a decimal number. Set it to `false`

if the `int`

type cannot do this.

Doesn’t the set of decimal numbers contain the set of integers? I’m not sure because I didn’t learned arithmetic in English. For me, the assertion “the `int`

type can hold **a** decimal number” is true, because I think the `int`

type can hold a decimal number which is an integer. (Of couse, “the `int`

type can hold **all** decimal numbers” is false.)

1 Like

Create a variable called `intsCanHoldDecimals`

. Set it to `true`

if the `int`

type can hold a decimal number. Set it to `false`

if the `int`

type cannot do this.

Hello there,

how does intCanHoldDecimals distinguish whether the user will input decimal or integer? Or is that not part of the question? The solution to this question is…

public class Booleans {

public static void main(String args) {

```
boolean intsCanHoldDecimals = false;
System.out.println(intsCanHoldDecimals);
```

}

}

int in Java is a wholly different thing. “int” in Java cannot hold a decimal number whereas “double” in Java can

2 Likes

Notes from the course:

//int holds positive numbers, negative numbers, and zero. They **do not** store fractions or numbers with decimals in them. The int data type allows values between -2,147,483,648 and 2,147,483,647,

//double can hold decimals as well as very large and very small numbers. The maximum value is 1.797,693,134,862,315,7 E+308, which is approximately 17 followed by 307 zeros. The minimum value is 4.9 E-324, which is 324 decimal places.

1 Like

Notes from the course:

Primitive datatypes are types of data built-in to the Java system

//int holds positive numbers, negative numbers, and zero. They **do not** store fractions or numbers with decimals in them. The int data type allows values between -2,147,483,648 and 2,147,483,647,

//double can hold decimals as well as very large and very small numbers. The maximum value is 1.797,693,134,862,315,7 E+308, which is approximately 17 followed by 307 zeros. The minimum value is 4.9 E-324, which is 324 decimal places.

1 Like

Decimal numbers are integers and non-integers like 10 and 0.3 - so in general “int” cant hold all of them. Doublles can.

1 Like

So “a decimal number” in their statement should be read as “any decimal number” or so? Are people reading this as “one of decimal numbers” few?

1 Like

Welcome to the world of coding. Appreciate you write in Java as elsewhere there are even more dragons to fight. Google “thank you for inventing javascript” phrase and you’ll understand.

2 Likes

I see. What I had in mind was the concept of mathematically defined numbers, but the numbers here are internally represented data stored in memory.

1 Like

10 is a decimal number. `int`

type can hold 10. But 10 of `int`

type is not called a decimal number here.

1 Like