This seems right to me, but I have six errors. Two say to delete the "else" and the other two say to add ";" in the if-then statement.
Code:
package alphabetical;
import java.util.*;
public class Alphabetical
{
static boolean precedes (String s1, s2, s3)
{
lowest = 0;
if (s1.precedes(s2)){
lowest = s1}
return true;
else {
lowest = s2;}
return false;
if (lowest.precedes(s3)){
lowest = lowest}
return true;
else {
lowest = s3;}
return false;
}
public static void main (Scanner scan)
{
Scanner sc = new Scanner (System.in);
//user input
System.out.print("Enter name 1:");
String s1 = sc.nextLine();
System.out.print("enter name 2: ");
String s2= sc.nextLine();
System.out.print("enter name 3: ");
String s3= sc.nextLine();
//answers
System.out.println("The string that comes first alphabetically is: " + precedes(lowest));
}
}