Challenge: Primitive Types
Taak
Swipe to start coding
Fill in the blanks with the appropriate primitive data types.
- The first blank needs to hold a whole number.
- The second blank should store a decimal number.
- The third blank type should have a range of numbers from -32,768 to 32,767.
- In the fourth blank, you need to store a single character.
- The fifth blank should hold a boolean value (
true
orfalse
). - The sixth blank stores a floating-point number with less precision than a
double
.
Oplossing
solution
99
1
2
3
4
5
6
7
8
9
10
11
12
13
package com.example;
public class Main {
public static void main(String[] args) {
byte myNum = 14;
double myFractional = 14.928;
short myBiggerNum = -710;
char myLetter = 'B';
boolean myBool = true;
float myWho = 1.74f;
System.out.println("It's working, well done!");
}
}
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 2. Hoofdstuk 2
99
1
2
3
4
5
6
7
8
9
10
11
12
13
package com.example;
public class Main {
public static void main(String[] args) {
___ myNum = 14;
___ myFractional = 14.928;
___ myBiggerNum = -710;
___ myLetter = 'B';
___ myBool = true;
___ myWho = 1.74f;
System.out.println("It's working, well done!");
}
}
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.