私は与えられた2つの数値の共通因子を見つける方法を作成しようとしていますが、コンパイルするファイルを取得できません。私の中括弧はすべて、このエラーの原因となるほとんどの場合、私はそれを認識しているので閉じています。うまくいけば誰かが私を助けることができます!Javeエラー:解析中にファイルの終わりに達しました(標準ではありません)
import java.util.Scanner;
public class E1{
public static void main (String [] args){
Scanner kb = new Scanner(System.in);
double n1,n2;
System.out.println("Enter two numbers");
n1=kb.nextDouble();
n2=kb.nextDouble();
printCommonFactors(n1,n2);
}
//call a method that prints the positive shared factors of the 2 inputed numbers
public static void printCommonFactors(int n1,int n2){
//determining the max/min of the two inputed variables
int max,min;
max=Math.max(n1,n2);
min=Math.min(n1,n2);
//setting up 2 arrays to store the factors
int [] maxFactors = new int [max];
int [] minFactors = new int [min];
int counter1;
for (inti=0;i>max;i++)
if (i%max=0)
counter1++;
maxFactors[counter1]=i;
for (int i=0;i>min;i++)
if (maxFactors[i]%min=0)
maxFactors[i]=
}
}
これは私が受け取るエラーです:「解析中にファイルの終わりに達し、」あなたが見ている理由は、パーサーが右サイドを見つけるために期待していることである
正確なエラーを受け取ってください –
ダブルサイズの配列を作成することはできません – Edwardth