I am getting a compile error with my DummyClass. not found in my
Student Record Exercise.

C:\myjavaprograms\
C:\ myjavaprograms\studentpackage\
C:\myjavaprograms\anotherpackage\

in the directory:\studentpackage
StudentRecordExample.java
StudentRecord.java

in the directory:\anotherpackage
DummyClass.java

Modified the class:
StudentRecord to import anotherpackage.*;
** this generates a compile error stating that it cannot find the
package or the class.

*** here is the code from the modified:
//this class now belongs to studentpackage package.
package studentpackage;

//import packages
import anotherpackage.*;

public class StudentRecord{
        //declare instance variabless
 private String name;
 private double mathGrade;
 private double englishGrade;
 private double scienceGrade;
 private double average;

// Declar static variables.
private static int studentCount = 0;

public String getName(){
        DummyClass test = new DummyClass();
        System.out.println(test.sayHello(name));
        return name;
}

public void setName(String temp){
name = temp;
}

public double getAverage(){
double result =0;
return result;
}

public static int getStudentCount(){
return studentCount;
}

public static void increaseStudentCount(){
studentCount++;
}

}

// code for DummyClass
package anotherpackage;

public class DummyClass {
   public String sayHello(String name){
        return "Hello, I am dummy.  Your name is " + name;
    }
}

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to