标签:java io for ar line new log ad
package javaapplication29;
import java.util.Scanner;
import java.util.StringTokenizer;
/**
*
* @author qingzhu
*/
public class JavaApplication29 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String[] mess={"整数部分","小数部分"};
Scanner reader=new Scanner(System.in);
double x=reader.nextDouble();
String s=String.valueOf(x);
StringTokenizer fenxi=new StringTokenizer(s,".");
for(int i=0;fenxi.hasMoreTokens();i++){
String str=fenxi.nextToken();
System.out.println(mess[i]+":"+str);}// TODO code application logic here
}
}
输入一个浮点数,并输出该数的整数部分和小数部分,布布扣,bubuko.com
标签:java io for ar line new log ad
原文地址:http://www.cnblogs.com/guet/p/3903307.html