Skip to content

This is a tutorial project. JavaBasics_Task_180_V0.1 Analyzing Java Stack Trace and ArithmeticException through an intentional division by zero error. 250226_1545

License

Notifications You must be signed in to change notification settings

YuriiJavaDev/JavaBasics_Task_180_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Culinary Proportion Calculator (JavaBasics_Task_180_V0.1)

📖 Description

This project is designed to help developers understand the Java Stack Trace. By intentionally causing a division by zero error, we simulate a critical bug in a culinary calculation module. The goal is to identify the exception type and the exact line of code responsible for the crash by analyzing the console output.

📋 Requirements Compliance

  • Task: Divide integer 10 by 0 in the main method.
  • Goal: Trigger an ArithmeticException and analyze the resulting Stack Trace.
  • Analysis: Identify the exception name and the line number in the source code.

🚀 Architectural Stack

  • Java 8+

🏗️ Implementation Details

The program performs a direct division of two integers: 10 / 0. Since division by zero is mathematically undefined for integers in Java, the JVM immediately stops execution and prints a Stack Trace. This trace includes the exception class, the error message, and the sequence of method calls leading to the failure.

📋 Expected result

Exception in thread "main" java.lang.ArithmeticException: / by zero
	at com.yurii.pavlenko.Solution.main(Solution.java:16)

Process finished with exit code 1

💻 Code Example

Project Structure:

src/com/yurii/pavlenko/
                └── Solution.java

Code

package com.yurii.pavlenko;

public class Solution {

    public static void main(String[] args) {

        int totalIngredients = 10;
        int ingredientsPerPortion = 0;
        int portionsCount = totalIngredients / ingredientsPerPortion;

        // This message will never be printed
        System.out.println("Portions possible: " + portionsCount);
    }
}

⚖️ 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_180_V0.1 Analyzing Java Stack Trace and ArithmeticException through an intentional division by zero error. 250226_1545

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages