I'm messing around with different libraries in Java and decided to make a program that redirects the user to the link they input into the program. It works but works only once. I would like for the user to keep inserting as many links as they'd like, one at a time, and have the program only end when they insert the keyword, "end"
What I have thus far:
(In the code you don't see where I try to have it loop because I'm unsure of how to start, I thought about using a String for the keyword, "end" then implementing an if statement where should they enter "end" it'll then stop but I was unable to have it work)
import java.awt.Desktop; import java.net.URI; import java.util.Scanner; public class ProgramURLLaucher { public static void main(String[] args) throws Exception { System.out.println("Input URL:"); Scanner scan = new Scanner(System.in); String link = scan.next(); Desktop userDesktop = Desktop.getDesktop(); userDesktop.browse(new URI(link)); }//end main }//end class