• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

can't get value from another class

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
on my main class i have the following:




then the three other classses/interface:






the code is very much self-explanatory,
what i want to achieve is i want to have somehing like : String s = questions[0].getQuestion(); to work in my main class.

Problem is it's as if Questions[] questions in main is empty which is why i am unable to invoke any of TrueOrFalse's methods

p.s. i do not know if the interface has anything to do with the problem, i just added it there for polymorphism
 
author
Posts: 23931
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Angelo Tan wrote:
Problem is it's as if Questions[] questions in main is empty which is why i am unable to invoke any of TrueOrFalse's methods



Hint: find the code that instantiates the questions array in the main class -- when you find that code (or not be able to find that code), you have your answer.

Henry
 
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I get the compiler error: The constructor TrueOrFalse(String) is undefined
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic