Scanner方法

package text03;

import java.util.Scanner;

public class text {
public static void main(String[] args) {
	  Scanner sc=new Scanner(System.in);
	  System.out.println("请输入你的名字:");
	  String name=sc.nextLine();
	  System.out.println("请输入你的爱好:");
	  String fovorite=sc.nextLine();
	  double salary=sc.nextDouble();
	  System.out.println(name+","+"favorite"+","+salary);
}
}

你可能感兴趣的:(java)