임 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