Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Goto {
- public static void main(final String[] args) {
- Scanner scan = new Scanner(System.in);
- int j = 1;
- test: if (j != 0) {
- loop: for (int i = 0; i < 4; i++) {
- System.out.println("Enter a value");
- int input = scan.nextInt();
- if (input < 0) {
- System.out.println("Enter 0 to quit");
- j = scan.nextInt();
- break test;
- } else {
- continue loop;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement