I have to as the user for 3 strings and print out whether the first string concatenated with the second is equal to the third string
public class ThreeStrings extends ConsoleProgram {
public void run()
{
String string1 = readLine("First string? ");
String string2 = readLine("Second string? ");
String string3 = readLine("Third String? ");
String combined = string1 + string2;
if(string3.equals("combined"))
{
System.out.println(string1 + " + " + string2 " is equal to " + combined);
}
else
{
System.out.println(string1 + " + " + string2 " is not equal to " + string3 + " ! ");
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire