"cannot find symbol method getMyVal()"
I am working on a project, and in testing, I came across the error in the title. I just cannot understand why I am getting it, though! Perhaps there is some coding nuance I am forgetting?
import java.util.*;
import java.io.*;
publicclass Mapping{
privateint myValue;
public Mapping (int yay){
myValue = yay;
}
publicint getMyVal(){
return myValue;
}
}
and my second class:
import java.util.*;
import java.io.*;
publicclass MappingTester{
publicstaticvoid main (String args[]){
HashMap map =new HashMap();
for (int i = 0; i<3; i++){
Mapping obj =new Mapping(i);
map.put(i, obj);
}
Object a = map.get(0);
Object b = map.get(1);
Object c = map.get(2);
System.out.println("The first obj has a value of "+ a.getMyVal());
System.out.println("The second obj has a value of "+ b.getMyVal());
System.out.println("The third obj has a value of "+ c.getMyVal());
}
}
I realize it's not very elegant/OO, but right now I'm just trying to get it to work. :)
Any help is appreciated!

