M
mycwcgr
Unregistered / Unconfirmed
GUEST, unregistred user!
下面的例子是从Java的help中抄的,请问String s = new String(buff);是什么意思?
下面的例子是从Java的help中抄的,请问String s = new String(buff);是什么意思?
是不是将buff中的字节转化为字符串,请问有逆转换吗?
import java.io.*;
class FileReader {
public static void main(String args[]) {
byte buff[] = new byte[80];
try {
InputStream fileIn = new FileInputStream("Readme.txt");
int i = fileIn.read(buff);
String s = new String(buff);
System.out.println(s);
}
catch(FileNotFoundException e) {
}
catch(IOException e) {
}
}
下面的例子是从Java的help中抄的,请问String s = new String(buff);是什么意思?
是不是将buff中的字节转化为字符串,请问有逆转换吗?
import java.io.*;
class FileReader {
public static void main(String args[]) {
byte buff[] = new byte[80];
try {
InputStream fileIn = new FileInputStream("Readme.txt");
int i = fileIn.read(buff);
String s = new String(buff);
System.out.println(s);
}
catch(FileNotFoundException e) {
}
catch(IOException e) {
}
}