ユーザーは文字列変数の値を入力できません。
これはプログラムです:
import java.io.*;
public class testing
{
char a;
int b;
double c;
String d;
public void method() throws IOException
{
BufferedReader p=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a variable of type 'char'");
a = (char)p.read();
System.out.println("Enter a variable of type 'string'");
d = p.readLine();
System.out.println("Enter a variable of type 'integer'");
b = Integer.parseInt(p.readLine());
System.out.println("Enter a variable of type 'double'");
c = Double.parseDouble(p.readLine());
System.out.println("Your values are: string-" +d +", integer-" +b +", double-" +c);
}
}
誰かが問題を見ることができますか?