1

问这个问题可能很愚蠢,但我真的需要解决这个问题:

我正在尝试编写一个可以获取阿拉伯字符串然后将它们显示为示例的代码,首先它应该要求您输入字符串,然后在下一行中显示该单词。

起初我尝试使用代码打击

    public class getString {          
    public static void main(String[] args) throws Exception {  
        PrintStream out = new PrintStream(System.out, true, "UTF-8");
        Reader r = new InputStreamReader(System.in, "UTF-8"); 
        char[] str ;
        str= new char[10];
        r.read(str);
        out.println(str);

}
}

但是如果此代码是一些未知字符,则输出

شیرین

我进行了研究,但不幸的是,除了代码攻击可以帮助我之外,我找不到任何有用的东西。

class ResourceControl extends ResourceBundle.Control {
@Override
public ResourceBundle newBundle(String baseName, Locale locale,String format, ClassLoader loader, boolean reload)
        throws IllegalAccessException, InstantiationException,IOException {
    String bundlename = toBundleName(baseName, locale);
    String resName = toResourceName(bundlename, "properties");
    InputStream stream = loader.getResourceAsStream(resName);
    return new PropertyResourceBundle(new InputStreamReader(stream,"UTF-8"));
}
}

但不幸的是,另一个问题是我不知道如何在我的代码中使用它?

谁能帮帮我吗??提前感谢您的关注

4

0 回答 0