为什么这段代码总是产生'?'的输出 [英] Why this code always produce output as '?'

查看:104
本文介绍了为什么这段代码总是产生'?'的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道java遵循unicode系统,它支持多种语言的所有字母表。我搜索并发现अ的Unicode值是2309,आ的值是2310,这是DEVANAGRI语言的字母表。我写的代码是这样的。

As we know java follows unicode system which supports all alphabets of many languages. I searched and found that Unicode value for अ is 2309 and value for आ is 2310 which are alphabets of DEVANAGRI language. The code i have written is something like this.

class Test
{
    public static void main(String args[])
    {
        char a=(char)2310;
        System.out.println(a);
    }
}

无论我写2309或2310输出是' ?'总是。如何发生这种情况?

No matters I write 2309 or 2310 the output is '?' always. How this is happening?

推荐答案

您正在尝试打印控制台字符集不支持的字符。您可以尝试更改此处提到的控制台字符集无法打印印地语字符

you are trying to print characters that are not supported by character set of console. you can try changing console character set as mentioned here Can't print hindi characters

这篇关于为什么这段代码总是产生'?'的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆