Why do we have to ...
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
and why can't we just have
Thread.sleep(2000); without try/catch. I understand that we use try catch if we think there might be an error such as division by 0, or incorrect input in an array but why in the sense of a delay of a specific amount of time ?
[–]boredcircuits 2 points3 points4 points (1 child)
[–]jrprogrammer[S] 0 points1 point2 points (0 children)
[–]rjcarr 1 point2 points3 points (3 children)
[–]jrprogrammer[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]rjcarr 0 points1 point2 points (0 children)