- #1
zatawave
- 2
- 0
I'm working on this code for my programming class and I'm completely stuck. Here is what I have so far but I keep getting error messages.
this is what I'm receiving once I run the code.
TextMsgAbbreviation.java:12: error: cannot find symbol
Scanner=new Scanner(System.in);
^
symbol: variable Scanner
location: class TextMsgAbbreviation
TextMsgAbbreviation.java:17: error: cannot find symbol
textMsg=txtMsg.nextLine();
^
symbol: variable txtMsg
location: class TextMsgAbbreviation
2 errors
Any help would be greatly appreciated.
Code:
import java.util.Scanner;
public class TextMsgAbbreviation {
public static void main(String[] args)
{
String BFF ="best friends forever";
String IMHO ="in my humble opinion";
String TMI = "too much information";
String LOL = "laughing out loud";
String IDK="I don't know";
Scanner=new Scanner(System.in);
String textMsg="";
System.out.println("Input an abbreviation:"+" ");
textMsg=txtMsg.nextLine();
if (textMsg.compareTo("BFF")==0)
{
System.out.println(BFF);
}
else if(textMsg.compareTo("IMHO")==0)
{
System.out.println(IMHO);
}
else if(textMsg.compareTo("TMI")==0)
{
System.out.println(TMI);
}
else if(textMsg.compareTo("LOL")==0)
{
System.out.println(LOL);
}
else if(textMsg.compareTo("IDK")==0)
{
System.out.println(IDK);
}
else
{
System.out.println("Unknown");
}
return;
}
}
this is what I'm receiving once I run the code.
TextMsgAbbreviation.java:12: error: cannot find symbol
Scanner=new Scanner(System.in);
^
symbol: variable Scanner
location: class TextMsgAbbreviation
TextMsgAbbreviation.java:17: error: cannot find symbol
textMsg=txtMsg.nextLine();
^
symbol: variable txtMsg
location: class TextMsgAbbreviation
2 errors
Any help would be greatly appreciated.
Last edited by a moderator: