我还没运行import java.util.*;import java.Math.*;这两句就提示我错了,求解是哪里出问题了?

import java.util.*;

public class Sort {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    Scanner input =new Scanner(System.in);
    String str=input.nextLine();
    
    char ch[]=str.toCharArray();
    String []words=str.split(".");
    double a[]=new double[2];
    for(int i=0;i<words.length;i++)
    {
        String s=words[i];
        a[i]=Double.parseDouble(s);
    }
    int zs=(int)a[0];
    int k=0;double y=a[1];
    while(y!=0)
    {
        y=y/10;
        k++;
    }
    int fz,fm;
    fz=(int)a[1];
    fm=(int)Math.pow((double)10,(double)k);
    int gcd=0,r;
    int b,c;b=fz;c=fm;
    r=b%c;
    while(r!=0)
    {
        b=c;
        c=r;
        r=b%c;
    }
    fz=fz/c;fm=fm/c;
    System.out.printf("%d %d %d",zs,fz,fm);
}

}

img

img

img


我改了以后又出现这个问题——

你引入包不对,Math是Java lang包下面的工具类

import java.util.*;

1、少了星号。
2、import java.Math.*; 这句要去掉,没有大写的Math这个包。Math.pow中的Math类是在java.lang下面的,这个包是默认导入的,不用写出来。

import java.util.*;
import java.lang.Math;

public class Sort {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner input =new Scanner(System.in);
        String str=input.nextLine();
        
        char ch[]=str.toCharArray();
        String []words=str.split(".");
        double a[]=new double[2];
        for(int i=0;i<words.length;i++)
        {
            String s=words[i];
            a[i]=Double.parseDouble(s);
        }
        int zs=(int)a[0];
        int k=0;double y=a[1];
        while(y!=0)
        {
            y=y/10;
            k++;
        }
        int fz,fm;
        fz=(int)a[1];
        fm=(int)Math.pow((double)10,(double)k);
        int gcd=0,r;
        int b,c;b=fz;c=fm;
        r=b%c;
        while(r!=0)
        {
            b=c;
            c=r;
            r=b%c;
        }
        fz=fz/c;fm=fm/c;
        System.out.printf("%d %d %d",zs,fz,fm);
    }
}