/*
* Main.java
*
* Created on 2007年4月14日, 下午5:15
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package javaapplication1;
/**
*
* @author hch
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main (String[] args) throws Exception
{
// TODO code application logic here
int 中1=System.in.read();
int 中2=System.in.read();
System.out.print((char)中1);
System.out.print((char)中2);
}
}
/*
我打算输入一个中文字符并显示,于是写了上面的程序,但结果并不如我想象的输出中文字符,显示了两个乱码,所以想请问大家怎么将输入中文字符并输出
*/
回 天之魔神:定义成字符型要用什么输入函数,用read()会出错
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
char[] chars = new char[2];
try {
br.read(chars);
System.out.println(chars);
}
catch(IOException ioe) {
ioe.printStackTrace();
}
}
}
var a
function aa(){
document.write("想输出的汉字")
}
</script>
<input type=button value=单击 onclick="aa()">