import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Danci {
public static void main(String[] args){
String str = new String();
System.out.print("请输入一个英文句子:");
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));//获取键盘输入
str = br.readLine();
}catch(IOException e){
e.printStackTrace();
}
String []s = str.split(" ");//转换成数组
System.out.println("你输入的句子***有单词 "+s.length+" 个");//s.length获取数组长度
}
}
//此程序只能获取一句话的单词个数.