On Jun 6, 2:52 am, oj <[email protected]> wrote:
> when i try to compile the lab1003  2.3 for java classpath it get this
>
> C:\>cd myjavaprograms
>
> C:\myjavaprograms>dir
>  Volume in drive C is HP_PAVILION
>  Volume Serial Number is 1C52-8531
>
>  Directory of C:\myjavaprograms
>
> 06/04/2009  10:16 PM    <DIR>          .
> 06/04/2009  10:16 PM    <DIR>          ..
> 06/04/2009  10:17 PM    <DIR>          foodpackage
> 06/04/2009  10:09 PM    <DIR>          studentpackage
>                0 File(s)              0 bytes
>                4 Dir(s)  11,411,202,048 bytes free
>
> C:\myjavaprograms>javac studentpackage/*.java
> studentpackage\StudentRecord.java:4: package anotherpackage does not
> exist
> import anotherpackage.*;
I think, directory anotherpackage is within studentpackage. Try moving
it into myjavaprogram.
> ^
> studentpackage\StudentRecord.java:19: cannot find symbol
> symbol  : class DummyClass
> location: class studentpackage.StudentRecord
>       DummyClass dummy = new DummyClass();
>       ^
> studentpackage\StudentRecord.java:19: cannot find symbol
> symbol  : class DummyClass
> location: class studentpackage.StudentRecord
>       DummyClass dummy = new DummyClass();
>                              ^
> 3 errors
>
> C:\myjavaprograms>
>
> what is the issue i'm lost . i have the following files
>
> C:\myjavaprograms\studentpackage\StudentRecord.java
> // This class now belongs to studentpackage package.
> package studentpackage;
> // Import packages
> import anotherpackage.*;
>
> public class StudentRecord {
>
>     // Declare instance variables.
>     private String name;
>     private double mathGrade;
>     private double englishGrade;
>     private double scienceGrade;
>     private double average;
>
>     // Declare static variables.
>     private static int studentCount = 0;
>
>     public String getName(){
>       DummyClass dummy = new DummyClass();
>       System.out.println(dummy.sayHello(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++;
>     }
>
> }
>
> C:\myjavaprograms\studentpackage\StudentRecord.java
> // This class now belongs to studentpackage package.
> package studentpackage;
>
> public class StudentRecordExample {
>
>     public static void main(String[] args) {
>
>         // Create an object instance of StudentRecord class.
>         StudentRecord annaRecord =new StudentRecord();
>
>         // Increament the studentCount by invoking a static method.
>         StudentRecord.increaseStudentCount();
>
>         // Create another object instance of StudentRecord class.
>         StudentRecord beahRecord =new StudentRecord();
>
>         // Increament the studentCount by invoking a static method.
>         StudentRecord.increaseStudentCount();
>
>         // Create the 3rd object instance of StudentRecord class.
>         StudentRecord crisRecord =new StudentRecord();
>
>         // Increament the studentCount by invoking a static method.
>         StudentRecord.increaseStudentCount();
>
>         // Set the names of the students.
>         annaRecord.setName("Anna");
>         beahRecord.setName("Beah");
>         crisRecord.setName("Cris");
>
>         // Print anna's name.
>         System.out.println("Name = " + annaRecord.getName());
>
>         // Print number of students.
>         System.out.println("Student Count =
> "+StudentRecord.getStudentCount());
>
>     }
>
> }
>
> C:\myjavaprograms\studentpackage\anotherpackage\DummyClass.java
> package anotherpackage;
>
> public class DummyClass {
>    public String sayHello(String name){
>         return "Hello, I am dummy.  Your name is " + name;
>     }
>
> }
>
> Someone Please Help

--~--~---------~--~----~------------~-------~--~----~
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