Deb Pati

Greenhorn
+ Follow
since Aug 04, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Deb Pati

Sorry guys,

made the same mistake again ! Hit the tab key or something and
my reply got posted half way. Please let me know how I could have
gotten back to my half edited reply.

But, for now let me continue with what my friend suggested:

Write the constructor of Manager as:

public Manager(int direction){
this.direction = direction;
cache = new ArrayList<KeyValue>();
}

Then in the class Caller:

public void callerMethod(){
int direction = 3;
Manager m = new Manager(direction);

This way, the constructor of Manager will create an instance
of ArrayList<KeyValue> within the callerMethod.

BTW, the class Manager and Caller are in 2 different packages.

Thanks for the life(job) saver replies. I will give a
try to the posted suggestion and my friends and hopefully one
of them will work.
18 years ago
Thanks a lot guys ! I had indented my first msg., but
it did not preserve it. Should I use spaces or tabs to
get the lines indented? Also, I don't know how I could
have got back to my first incomplete mail and have it
completed.

Now, to the technical answers: I wanted to use the benefit
of inner class in the rest of my actual code....hence I had
declared KeyValue that way. I do need it to be visible in
the Calling class and I know it can be done. I will try the
suggestion of <Manager.KeyValue> However, I recently talked
to another friend who gave a good suggestion too. It is
to have the contructor of Manager class be like:

public Manager(int direction){
this.direction = direction;
18 years ago
Hi all,

I have the following code segment: It has a "Manager" class with an inner class called "KeyValue". Another class named "Caller" tries to instantiate an object of type Manager. The Eclipse debugger gave a ClassNotFoundException at line number 19. So looks like there is a
runtime problem in finding and loading the class dynamically as it is a generic type. Please, please help me soon.

1. public class Manager{

//*** inner class ***
2. public class KeyValue {
3. protected Object element;
4. protected Object value;
5. public KeyValue(Object element, Object value) {
6. this.element = element;
7. this.value = value;
8. }
9. }
//***** inner class end *****

10. protected List<KeyValue> cache;
11. int direction;

12. public Manager(List<KeyValue> cache,int direction){
13. this.cache = cache;
14. this.direction = direction;

15. }
16. }
----------------------------------
17. public class Caller{

18. public void callerMethod{
19. List<KeyValue> mycache = new ArrayList<KeyValue>();
20. int Direction = 3;
21. Manager m = new Manager(mycache, 3);
22. }
23.}
18 years ago
Hi all,

I have the following code segment: It has a "Manager" class with an inner class called "KeyValue". Another class named "Caller" tries to instantiate an object of type Manager. The Eclipse debugger showed gave a ClassNotFoundException at the

1. public class Manager{
2. public class KeyValue {
3. protected Object element;
4. protected Object value;
5. public KeyValue(Object element, Object value) {
6.this.element = element;
7.this.value = value;
}
}

8.protected List<KeyValue> cache;
9.int direction;

10.public Manager(List<KeyValue> cache,int direction){
11.this.cache = cache;
12.this.direction = direction;

}
}

13. public class Caller{

14. public void callerMethod{
15.List<KeyValue> mycache = new ArrayList<KeyValue>();
int Direction = 3;
Manager m = new Manager(mycache, 3);
}
}
18 years ago