• Post Reply Bookmark Topic Watch Topic
  • New Topic

variable cannot be resolved Error  RSS feed

 
jaya kemmannu
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

Trying to call array list of another class, inside main function, But getting  " cannot be resolved" Error. Any idea how to solve this ?



Rgds,
Jay
 
Sac Jadhav
Greenhorn
Posts: 21
Hibernate Java jQuery
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use worker1.executorList
 
Sac Jadhav
Greenhorn
Posts: 21
Hibernate Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot access executorList directly
 
jaya kemmannu
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can we create object of MyRunnable in main function and then access it ?

 
Campbell Ritchie
Marshal
Posts: 56578
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jaya kemmannu wrote:. . . Trying to call array list of another class, inside main function . . .
You shouldn't want access to fields of another class. And you should't have such code in the main method. Why would you want access to such a List? When you explain what you are trying to do, you may be able to work out how to do it.
Anything created inside a method is local to that method and cannot be accessed elsewhere. Your problem is that you are not creating an object to encapsulate your application.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!