Handling Exceptions in Logistics Systems
This program demonstrates handling exceptions in logistics systems.
Problem Statement
Write a Java program that simulates logistics delivery failure and handles exceptions.
Source Code
| 1 | public class LogisticsExceptionExample { |
| 2 | public static void main(String[] args) { |
| 3 | System.out.println("Eduinq Logistics Exception Example"); |
| 4 | try { |
| 5 | deliverPackage("delayed"); |
| 6 | } catch(Exception e) { |
| 7 | System.out.println("Eduinq Exception: Logistics Error - "+e.getMessage()); |
| 8 | } |
| 9 | } |
| 10 | static void deliverPackage(String status) throws Exception { |
| 11 | if("delayed".equals(status)) throw new Exception("Delivery Delayed"); |
| 12 | System.out.println("Eduinq Package Delivered Successfully"); |
| 13 | } |
| 14 | } |
Program Output
Eduinq Logistics Exception Example Eduinq Exception: Logistics Error - Delivery Delayed
Explanation
Logistics systems may fail due to delays or route issues. - Exception handling ensures graceful error reporting. - Provides meaningful feedback for debugging. - In enterprise systems, logistics exception handling ensures reliable supply chain. Conclusion: Shows handling exceptions in logistics systems.