Skip to content

YuriiJavaDev/JavaBasics_Task_259_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Global Constants: Static Immutable Storage (JavaBasics_Task_259_V0.1)

📖 Description

In application development, certain values like mathematical PI or the number of days in a year remain constant throughout the entire execution. This project demonstrates the creation of a Utility Class for global constants. By combining public, static, and final modifiers, we make these values globally accessible, shared across the JVM, and protected from any modification.

📋 Requirements Compliance

  • Static Access: Constants are accessible via the class name without instantiation.
  • Immutability: The final keyword prevents any changes to the values.
  • Naming Convention: Followed the UPPER_SNAKE_CASE standard for constants.
  • Global Visibility: Used the public modifier to allow access from any package.

🚀 Architectural Stack

  • Java 8+ (Access Modifiers, Static Constants, Naming Conventions)

🏗️ Implementation Details

  • GlobalConstants: A non-instantiable utility class holding shared fixed data.
  • GlobalConstantsApp: The consumer class that demonstrates direct field access.

📋 Expected result

The number PI: 3.14159
Standard number of days in a year: 365

💻 Code Example

Project Structure:

JavaBasics_Task_259/
├── src/
│   └── com/yurii/pavlenko/
│                  ├── GlobalConstants.java
│                  └── GlobalConstantsApp.java
└── README.md

Code

package com.yurii.pavlenko;

public class GlobalConstantsApp {

    public static void main(String[] args) {

        System.out.println("The number PI: " + GlobalConstants.MATH_PI);
        System.out.println("Standard number of days in a year: " + GlobalConstants.CALENDAR_DAYS_IN_YEAR);
    }
}
package com.yurii.pavlenko;

public class GlobalConstants {

    public static final double MATH_PI = 3.14159;
    public static final int CALENDAR_DAYS_IN_YEAR = 365;
}

⚖️ 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

This is a tutorial project. JavaBasics_Task_259_V0.1 Global Constants: implementing a utility class for immutable mathematical and calendar values using public static final fields. 190326_1215

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages