Trying to write a test program, that determines what type of organization is indicated by a web address.
Here's the code so far:
import java.util.Scanner;
public class WebTest
{
public static void main (String[] args)
{
Scanner input = new Scanner(System.in);
String[] url = {"com", "net", "org", };
String[] message = {"Business", "Network", "Organization", };
System.out.println("Please enter a url ending in .com, .net or .org");
String userinput = input.nextLine();
if (url == com )
{
System.out.println("Business");
}
else if (url == net )
{
System.out.println("Network");
}
else if (url == org )
{
System.out.println("Organization");
}
else
{
System.out.println("Invalid Input");
}
}
}
Aucun commentaire:
Enregistrer un commentaire