• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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: 23928
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
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic