From 47b159575d177059117d2013b03b4e195b1bca6a Mon Sep 17 00:00:00 2001 From: Mandeep Moun <103162424+zectsu@users.noreply.github.com> Date: Tue, 28 Oct 2025 23:13:55 -0600 Subject: [PATCH] Update Test_1.java --- Assignment-3/javaparser-1.0.0/Test_1.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Assignment-3/javaparser-1.0.0/Test_1.java b/Assignment-3/javaparser-1.0.0/Test_1.java index 9e12ce8..be0210d 100644 --- a/Assignment-3/javaparser-1.0.0/Test_1.java +++ b/Assignment-3/javaparser-1.0.0/Test_1.java @@ -1,4 +1,4 @@ -public class test_1{ +public class Test_1{ public int calculate(int x){ switch(x){ case 1: x += 10; @@ -14,15 +14,17 @@ public class test_1{ } return finalValue(x); } - private int riskyOp(int input) Exception { + int riskyOp(int input) throws Exception { if (input < 0){ throw new Exception("Negative input"); } return input + 5; } - private int finalValue(int val){ + int finalValue(int val){ return val*2; } - -int result = this.calculate(2); +public static void main(String[] args){ + Test_1 obj = new Test_1(); +int result = obj.calculate(2); + System.out.println("Result: " + result);} }