编写一个应用Java应用程序,要求用户首先分别输入名字和姓,然后打印输出一个字符
展开全部
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class TestJava {
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入姓:");
String str1=br.readLine();
System.out.println("请输入名:");
String str2=br.readLine();
System.out.println("您输入的姓名为:"+str1+str2);
}
}
import java.io.IOException;
import java.io.InputStreamReader;
public class TestJava {
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入姓:");
String str1=br.readLine();
System.out.println("请输入名:");
String str2=br.readLine();
System.out.println("您输入的姓名为:"+str1+str2);
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Test t = new Test();
String name = t.f("input name");
String family_name = t.f("input family_name");
System.out.println(family_name+" "+ name);
}
public String f(String info) {
System.out.println(info);
Scanner keyBord = new Scanner(System.in);
String str = keyBord.next();
return str;
}
}
public class Test {
public static void main(String[] args) {
Test t = new Test();
String name = t.f("input name");
String family_name = t.f("input family_name");
System.out.println(family_name+" "+ name);
}
public String f(String info) {
System.out.println(info);
Scanner keyBord = new Scanner(System.in);
String str = keyBord.next();
return str;
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询