Skip to main content



      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] Fri, 12 April 2013 21:07 Go to next message
Eclipse UserFriend
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 01:57 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 00:03:28 EDT 2025

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

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

Back to the top