Hi,
Having a few problems with strings.
I have this code and it wont compile.
I am trying to write a program so that I can input two strings, and then tests the strings to see whether they are identical or, if not, which comes first in the alphabet.
Can someone show me whats wrong with the codeCode:public class Strings { public static void main (String[] args) { System.out.print("Please Enter First String: "); string1 = EasyIn.getInt(); System.out.print("Please Enter Second String: "); string2 = EasyIn.getInt(); if (string1.equals(string2)) System.out.println("The Strings are Identical"); else if (string1.compareTo(string2) >0 ) System.out.println("The String1 comes first in alphabetical Order"); else if (string1.compareTo(string2) < 0) System.out.println("The String2 comes first in alphabetical order"); } }
Thanks


Reply With Quote


Bookmarks