Files
Software-Analysis/Assignment-3/javaparser-1.0.0/Test_1.java
2025-10-28 21:59:27 -06:00

29 lines
508 B
Java

public class test_1{
public int calculate(int x){
switch(x){
case 1: x += 10;
break;
case 2: x *= 2:
break;
default: x = -1;
}
try{
x = riskyOp(x);
} catch (Exception e){
x = 0;
}
return finalValue(x);
}
private int riskyOp(int input) Exception {
if (input < 0){
throw new Exception("Negative input");
}
return input + 5;
}
private int finalValue(int val){
return val*2;
}
int result = this.calculate(2);
}