如何解决错误"表达式非法启动?


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

public class Factors{
    protected int m;
    protected Vector myVector;
    protected int primeFactors;
    public Factors(int m) {
        myVector=new Vector();
        this.m=m;
        primeFactors=0;
        public Vector thefactors(){
            for(int i=2;i<=Math.sqrt(m);i++) {
                if (m%i==0) {
                    myVector.add(i);
                }
                primeFactors=myVector.add(i);
            }
            return this.get(primeFactors);
        }
    }
    public static void main(String[] args) {
            /*tests the methods implementation and 
            converts the command-line string arguments
            to integers */
            int num = Integer.parseInt(args[0]);
            Factors roy = new Factors(num);
            roy.thefactors();
    }
}

构造函数中有一个方法 - 不允许。

 public Factors(int m) {
    myVector=new Vector();
    this.m=m;
    primeFactors=0;
    public Vector thefactors(){

最新更新