0

i had an error although i compiled Semester1 class and they are at the same package

public class Semester2{
 String subjects2[] = {"Arabic 2","Islamic 2","English 2","calculas","java1","manegment","physecs2"};
        double degrees2[] = new double [7];
        int hours2[] = {2,2,2,4,4,2,3};
        double subjectpoint2[] = new double[7];
                String[]estimate2 = new String[7];
                double fullDegree2 = 0;
                int fail2 = 0;  //fail subjects
        public Semester2(){
        }
        public Semester2(double degrees2[],String subjects2[]){
                    for(int i=0;i<7;i++){
                        this .degrees2[i] = degrees2[i];
                        subjectpoint2[i] = degrees2[i] / 25;

                        fullDegree2 = 0;
                        fail2 = 0;
                    } //end of for
       } //end of constructer
                 public double Semester2Method(double degrees2[],String subjects2[],String[]estimate2,double fullDegree2,int fail2,double subjectpoint2[],int hours2[]){
                     for(int i=0;i<7;i++){
                        if ((degrees2[i] > 100)|(degrees2[i] < 0)){
                         System.out.println("this degree is imposible");
                         i--;
                         continue;
                     } //end of if
               if (degrees2[i] < 40)
                 fail2 ++;
               else
                  if (subjectpoint2[i] >= 3.6)
                   estimate2[i]="A+";
                  if (subjectpoint2[i] >= 3.2)
                   estimate2[i] = "A";
                    if (subjectpoint2[i] >= 2.8)
                   estimate2[i] = "B+";
                   if (subjectpoint2[i] >= 2.6)
                   estimate2[i] = "B";
                   if (subjectpoint2[i] >= 2.4)
                   estimate2[i] = "C+";
                   if (subjectpoint2[i] >= 2.0)
                   estimate2[i] = "C";
                   if (subjectpoint2[i] >= 1.6)
                   estimate2[i] = "D";
                   else

                   estimate2[i] = "F";
                  fullDegree2 += subjectpoint2[i] * hours2[i];
                  }//end of for
                 Semester1 [] obj=new Semester1[2];
                  obj[0]=new Semester1();
                  obj[1]=new Semester1(degrees[7],subjects[7]);
                 //Semester1 obj = new Semester1();

                 double avarge = fullDegree2 /19;
                 double cavarge=( fullDegree2 + obj[1].fullDegree )/( 21 + 19 );
                 return cavarge;

             } //end of the method
         } //end of semester2

here is the error error: cannot find symbol

Semester1 [] obj=new Semester1[2];
                 ^
Identity1
  • 1,139
  • 16
  • 33
azza
  • 11
  • 4

2 Answers2

1

Your Semester1.java file has not been compiled, as I can guess from your comments. You need to first compile that file. That would create Semester1.class file. Then you should compile Semester2.java. I think this should work.

dryairship
  • 6,022
  • 4
  • 28
  • 54
  • i got it but when i compile file Semester1 it did not create Semester1.class but create Semester1.java – azza Jan 29 '16 at 12:21
  • 1
    `Semester1.java` is the source code of the file. you need to compile it. Tell me how you are compiling it... – dryairship Jan 29 '16 at 12:24
  • @azza: You're definitely confused somewhere. `Semester1.java` should be the (text) file that **you** created, containing the source code for that class. That's the file that you *supply* to the compiler; the compiler will never create it. Instead it'll create a `Semester1.class` file which contains the compiled output. – Andrzej Doyle Jan 29 '16 at 12:35
  • @azza You need to compile Semester1.java using `javac Semester1.java` in the command line – dryairship Jan 29 '16 at 12:45
  • javac not recognized as an internal or external command operable program or patch file – azza Jan 29 '16 at 13:03
  • Well well well. Then how do you compile? – dryairship Jan 29 '16 at 13:07
  • i did what you tell me to do and that what i got at command line – azza Jan 29 '16 at 13:38
  • @azza See this : http://stackoverflow.com/q/1678520/4121347 and remove the error and then do `javac Semester1.java` – dryairship Jan 30 '16 at 11:46
0

check if Semester1.class file is created by checking in the file directory