Wondering if anyone can help with problem of API's
compiler issue found at MyLong class imports error says 'class' or 'interface' expected
import java.util.*; import java.io.*; import java.util.Scanner; public class PGM4 { public static void main(String[] args) throws IOException { String fname; int temp; MyLong nums []; Scanner kb = new Scanner(System.in); System.out.println("How many MyLong objects do you want to have? " + "\nAn input of 30 or more is suggested."); temp = kb.nextInt(); nums = new MyLong[temp]; System.out.print("Enter the output filename: "); Scanner file1 = new Scanner(System.in); fname = file1.nextLine(); FileWriter fwriter = new FileWriter(fname); PrintWriter myOutputFile = new PrintWriter(fwriter); PrimeChecker pCheck = new PrimeChecker(); for(int i = 0; i < nums.length; i++) { nums[i] = new MyLong(); nums[i].fillPrimeInfo(); } myOutputFile.println("Mixed Numbers: "); for(int i = 0; i < nums.length; i++) { myOutputFile.print("\n" + nums[i].getNum()); if(pCheck.primeOrNot(nums[i].getNum())== 1) { myOutputFile.println(" is a prime number."); myOutputFile.println("The largest prime number before " + nums[i].getNum() + " is " + nums[i].getNextSmallerPrimeNumber()); myOutputFile.println("The largest prime number after " + nums[i].getNum() + " is " + nums[i].getNextLargerPrimeNumber()); } else if(pCheck.primeOrNot(nums[i].getNum())!= 1) { myOutputFile.println(" is not a prime number." + " It is divisible by: " + pCheck.primeOrNot(nums[i].getNum())); myOutputFile.println("The largest prime number before " + nums[i].getNum() + " is " + nums[i].getNextSmallerPrimeNumber()); myOutputFile.println("The largest prime number after " + nums[i].getNum() + " is " + nums[i].getNextLargerPrimeNumber()); }} myOutputFile.println("\nPrime Numbers: "); for(int i = 0; i < nums.length; i++) if(pCheck.primeOrNot(nums[i].getNum())== 1) myOutputFile.println(nums[i].getNum()); myOutputFile.println("\nNon-Prime Numbers: "); for(int i = 0; i < nums.length; i++) if(pCheck.primeOrNot(nums[i].getNum())!= 1) myOutputFile.println(nums[i].getNum()); myOutputFile.close(); } } // *****************MyLong class********************** import java.util.Random; import java.math.*; public class MyLong { private long num; byte smallestFactor; long nextSmallerPrimeNumber, nextLargerPrimeNumber; public MyLong() { Random rd = new Random(); num = Math.abs(rd.nextLong()); smallestFactor = 1; nextSmallerPrimeNumber = 0; nextLargerPrimeNumber = 0; } public void fillPrimeInfo() { PrimeChecker pCheck = new PrimeChecker(); long ck = pCheck.primeOrNot(num); if( ck == 1) smallestFactor = 1; else smallestFactor = ck; for(int s = num-1; s > 0; s--) if(pCheck.primeOrNot(s) == 1) { nextSmallerPrimeNumber = s; break;} for(int j = num + 1; j < System.currentTimeMillis(); j++) if(pCheck.primeOrNot(j)==1) { nextLargerPrimeNumber = 1; break;} } public long getNum() {return num;} public byte getSmallestFactor() {return smallestFactor;} public long getNextSmallerPrimeNumber() {return nextSmallerPrimeNumber;} public long getNextLargerPrimeNumber() {return nextLargerPrimeNumber;} } //********************primeChecker class*********************** public class PrimeChecker { public static long primeOrNot(long x) { if(x == 2) return 1; for(long y = 2; y < x/2; y++) if(x%y == 0) return y; return 1; } }