Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 55badac

Browse files
Working with Primitive Data Types
1 parent 4684687 commit 55badac

File tree

6 files changed

+92
-0
lines changed

6 files changed

+92
-0
lines changed

‎Task-05/.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
### IntelliJ IDEA ###
2+
out/
3+
!**/src/main/**/out/
4+
!**/src/test/**/out/
5+
6+
### Eclipse ###
7+
.apt_generated
8+
.classpath
9+
.factorypath
10+
.project
11+
.settings
12+
.springBeans
13+
.sts4-cache
14+
bin/
15+
!**/src/main/**/bin/
16+
!**/src/test/**/bin/
17+
18+
### NetBeans ###
19+
/nbproject/private/
20+
/nbbuild/
21+
/dist/
22+
/nbdist/
23+
/.nb-gradle/
24+
25+
### VS Code ###
26+
.vscode/
27+
28+
### Mac OS ###
29+
.DS_Store

‎Task-05/.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Task-05/.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Task-05/.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Task-05/Task-05.iml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>

‎Task-05/src/Main.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//Exercise 5: Working with Primitive Data Types
2+
//5. Task: Declare variables for different data types: byte, short, int, long, float, double, char, and boolean.
3+
// Assign values to each and print them.
4+
//o Expected Output:
5+
//Byte value: [Your Byte Value]
6+
//Short value: [Your Short Value]
7+
//Int value: [Your Int Value]
8+
//Long value: [Your Long Value]
9+
//Float value: [Your Float Value]
10+
//Double value: [Your Double Value]
11+
//Char value: [Your Char Value]
12+
//Boolean value: [Your Boolean Value]
13+
14+
15+
public class Main {
16+
public static void main(String[] args) {
17+
byte byteContainer = 102;
18+
short shortContainer = 21;
19+
int intContainer = 1;
20+
long longContainer = 2423234293L;
21+
float floatContainer = 21.2f;
22+
double doubleContainer = 2.232;
23+
char charContainer = 'f';
24+
boolean booleanContainer = true;
25+
26+
System.out.println("Byte value: " + byteContainer);
27+
System.out.println("Short value: " + shortContainer);
28+
System.out.println("Int value: " + intContainer);
29+
System.out.println("Long value: " + longContainer);
30+
System.out.println("Float value: " + floatContainer);
31+
System.out.println("Double value: " + doubleContainer);
32+
System.out.println("Char value: " + charContainer);
33+
System.out.println("Boolean value: " + booleanContainer);
34+
}
35+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /