Handling Exceptions in Supply Chain
This program demonstrates handling exceptions in supply chain management.
Problem Statement
Write a Java program that simulates supply chain disruption and handles exceptions.
Source Code
| 1 | public class SupplyChainExceptionExample { |
| 2 | public static void main(String[] args) { |
| 3 | System.out.println("Eduinq Supply Chain Exception Example"); |
| 4 | try { |
| 5 | manageSupply("disrupted"); |
| 6 | } catch(Exception e) { |
| 7 | System.out.println("Eduinq Exception: Supply Chain Error - "+e.getMessage()); |
| 8 | } |
| 9 | } |
| 10 | static void manageSupply(String status) throws Exception { |
| 11 | if("disrupted".equals(status)) throw new Exception("Supply Chain Disrupted"); |
| 12 | System.out.println("Eduinq Supply Chain Stable"); |
| 13 | } |
| 14 | } |
Program Output
Eduinq Supply Chain Exception Example Eduinq Exception: Supply Chain Error - Supply Chain Disrupted
Explanation
Supply chains may fail due to disruptions or shortages. - Exception handling ensures graceful error reporting. - Provides meaningful feedback for debugging. - In enterprise systems, supply chain exception handling ensures operational continuity. Conclusion: Shows handling exceptions in supply chain management.