I'm a beginner in java, and I've been wondering about this. Is there any way to make the code loop back if it caught an exception? For example, in this code, can I make it so that it loops back and makes the user put in input again if there was an error?
double divide = 0;
try {
divide = sc.nextDouble();
}
catch (Exception e) {
System.out.println("Please enter an actual number.");
}