Skip to content

YuriiJavaDev/JavaBasics_Task_5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Game Character Profile (JavaBasics_Task_5)

📌 Description

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.

🚀 Task Requirements

  1. Declare four variables of specific types:
    • byte for level
    • int for goldAmount
    • double for rating
    • String for characterName
  2. Assign values to these variables.
  3. Print all character data to the screen.

🛠 Data Types & Logic

Each data type was chosen to optimize memory and ensure correct data representation:

  • byte: Used for level (range -128 to 127), which is perfect for game levels while saving memory.
  • int: Used for goldAmount to handle large integer values.
  • double: Used for rating to support decimal precision.
  • String: Used for characterName to store textual data.

🛠 Technical Stack

  • Language: Java 23
  • IDE: IntelliJ IDEA
  • Concepts covered: Primitive data types (byte, int, double), Reference types (String), Variable initialization, Console output.

⌨️ Practical Implementation

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);
    }
}

⚖️ License

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

About

Educational project - creating a game character profile using various Java data types. 140126_1444

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages