• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

variable cannot be resolved Error

 
Ranch Hand
Posts: 99
  • 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
 
Greenhorn
Posts: 21
Hibernate jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use worker1.executorList
 
Sac Jadhav
Greenhorn
Posts: 21
Hibernate jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot access executorList directly
 
jaya kemmannu
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

 
Marshal
Posts: 66504
251
  • 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.
 
Goodbye moon men. Hello tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!