Skip to content

Commit ec2ce62

Browse files
author
AmiyahJo
committed
feat: adds imports
fix: moved string orderid in .java outside of try block
1 parent e22ce0f commit ec2ce62

File tree

1 file changed

+7
-3
lines changed
  • lesson_14/exceptions/exceptions_app/src/main/java/com/codedifferently/lesson14

1 file changed

+7
-3
lines changed

lesson_14/exceptions/exceptions_app/src/main/java/com/codedifferently/lesson14/Lesson14.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package com.codedifferently.lesson14;
22

3+
import com.codedifferently.lesson14.ecommerce.EcommerceSystem;
4+
import com.codedifferently.lesson14.ecommerce.OrderNotFoundException;
5+
import com.codedifferently.lesson14.ecommerce.ProductNotFoundException;
6+
37
public class Lesson14 {
48

59
public static void main(String[] args) {
6-
// System.out.println("Hello World");
10+
String orderId = null;
711
try {
8-
String orderId = ecommerceSystem.placeOrder("1", 1);
12+
orderId = ecommerceSystem.placeOrder("1", 1);
913
} catch (ProductNotFoundException e) {
10-
System.out.println("Product with ID " + orderId + " not found.");
14+
System.out.println("Product with ID " + "1" + " not found.");
1115
} catch (OrderNotFoundException e){
1216
System.out.println("Order with ID " + orderId + " not found.");
1317
}

0 commit comments

Comments
 (0)