Skip to content

YuriiJavaDev/JavaBasics_Task_389_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library Tracker: Book Records (JavaBasics_Task_389_V0.1)

📖 Description

In data-oriented applications, managing object states efficiently is crucial. This project demonstrates the implementation of a Java Record to act as a simple data carrier for book information. By using the record keyword, we leverage built-in immutability and automatic accessor methods. This approach simplifies the code and ensures that each book entry remains consistent throughout the application's lifecycle.

📋 Requirements Compliance

  • Data Carrier: Defined a Book record to encapsulate title and author.
  • Immutability: Utilized the record's final nature to protect data integrity.
  • Accessor Usage: Used generated methods title() and author() for data retrieval.

🚀 Architectural Stack

  • Java 16+ (Records)

🏗️ Implementation Details

  • Book: A record representing a single library entry.
  • LibraryApp: The main entry point for creating and verifying book data.

📋 Expected result

Title: Effective Java
Author: Joshua Bloch

💻 Code Example

Project Structure:

JavaBasics_Task_389/
├── src/
│   └── com/yurii/pavlenko/
│                 ├── app/
│                 │   └── LibraryApp.java
│                 └── library/
│                     └── models/
│                         └── Book.java
├── LICENSE
├── TASK.md
├── THEORY.md
└── README.md

Code

package com.yurii.pavlenko.app;

import com.yurii.pavlenko.library.models.Book;

public class LibraryApp {

    public static void main(String[] args) {

        Book favoriteBook = new Book("Effective Java", "Joshua Bloch");

        System.out.println("Title: " + favoriteBook.title());
        System.out.println("Author: " + favoriteBook.author());
    }
}
package com.yurii.pavlenko.library.models;

public record Book(String title, String author) {
}

⚖️ 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_389_V0.1 Library Tracker: implementing a concise Book record to store and display title and author information. 060526_1204

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages