I am building a program and here's a bit of code:
Scanner input = new Scanner(System.in);
begin:
System.out.println("Enter first fraction: ");
String fraction_1 = input.nextLine();
System.out.println("Enter second fraction: ");
String fraction_2 = input.nextLine();
if(...){
...
} else {
...
break begin;
However in this, in the last line, 'begin' is colored red and an error is popping up:
Undefined label: begin
I want the program to jump to the line marked by begin, when else statement is true. I hope this is the correct way to do that. If not, what should I do?