This project demonstrates the use of various Java primitive and reference data types. The goal was to create a profile for a game character by storing different types of information (level, gold, rating, and name) and displaying them in the console.
- Declare four variables of specific types:
bytefor levelintfor goldAmountdoublefor ratingStringfor characterName
- Assign values to these variables.
- Print all character data to the screen.
Each data type was chosen to optimize memory and ensure correct data representation:
byte: Used forlevel(range -128 to 127), which is perfect for game levels while saving memory.int: Used forgoldAmountto handle large integer values.double: Used forratingto support decimal precision.String: Used forcharacterNameto store textual data.
- Language: Java 23
- IDE: IntelliJ IDEA
- Concepts covered: Primitive data types (byte, int, double), Reference types (String), Variable initialization, Console output.
The code follows Java naming conventions and clean code principles:
package com.yurii.pavlenko;
public class Task_5_App {
public static void main(String[] args) {
// Variable initialization
byte level = 85;
int goldAmount = 150500;
double rating = 4.95;
String characterName = "ShadowHunter";
// Output to console
System.out.println("Character Name: " + characterName);
System.out.println("Level: " + level);
System.out.println("Gold Amount: " + goldAmount);
System.out.println("Rating: " + rating);
}
}This project is licensed under the MIT License.
Copyright (c) 2026 Yurii Pavlenko
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...
License: MIT