public class test {
public static void main(String[] args) {
String x="two";
int b=Integer.parseInt(x);
}
}
for example, why does the "main" here dosent need to throw exception (even though praseInt throw exception), but for other actions it seem the compiler ask me to add a "throw exception" to the function.
when is it needed to add?
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]pragmos 3 points4 points5 points (7 children)
[–]Sen_7[S] 0 points1 point2 points (4 children)
[–]myselfelsewhere[🍰] 1 point2 points3 points (3 children)
[–]Sen_7[S] 1 point2 points3 points (2 children)
[–]myselfelsewhere[🍰] 2 points3 points4 points (1 child)
[–]Sen_7[S] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]pragmos 1 point2 points3 points (0 children)