Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Russian Letters Are Not Being Recongnized(When I running through this program it would not recognize any of the words that used Cyrillic. The program would go through the else if and not see that the console word and word in parentheses were )
icon5.gif  Russian Letters Are Not Being Recongnized [message #1040052] Sat, 13 April 2013 01:07 Go to next message
Alan T is currently offline Alan T
Messages: 1
Registered: April 2013
Junior Member
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);

System.out.println("здравствуйте!");
String response = sc.nextLine();

if(response.equals ("привет"))
System.out.println("Correct!");
else if(response.equals("добрый день"))
System.out.println("Correct!");
else if(response.equals("добрый утро"))
System.out.println("Correct!");
else if(response.equals("добрый вечер"))
System.out.println("Correct!");
else if(response.equals("здравствуйте"))
System.out.println("Correct!");
else
System.out.println("no");

}

}
Re: Russian Letters Are Not Being Recongnized [message #1040817 is a reply to message #1040052] Sun, 14 April 2013 05:57 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26050
Registered: July 2009
Senior Member
Alan,

You should consider the issue of character encodings. What encoding is
the "Common" tab of your launcher specifying? Is that also the
default encoding of the JRE you're running? Probably you should
consider specifying UTF-8 for the console and specifying explicitly
using the java.util.Scanner.Scanner(InputStream, String) constructor.


On 13/04/2013 4:50 PM, Alan T wrote:
> import java.util.Scanner;
> public class Main {
> public static void main(String[] args) {
> Scanner sc = new Scanner(System.in);
>
> System.out.println("здравствуйте!");
> String response = sc.nextLine();
>
> if(response.equals ("привет"))
> System.out.println("Correct!");
> else if(response.equals("добрый день"))
> System.out.println("Correct!");
> else if(response.equals("добрый утро"))
> System.out.println("Correct!");
> else if(response.equals("добрый вечер"))
> System.out.println("Correct!");
> else if(response.equals("здравствуйте"))
> System.out.println("Correct!");
> else
> System.out.println("no");
>
> }
>
> }
Previous Topic:problem with starting eclipse
Next Topic:How to HELP!!
Goto Forum:
  


Current Time: Fri Sep 19 02:02:39 GMT 2014

Powered by FUDForum. Page generated in 0.01670 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software