Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can't get value from another class  RSS feed

 
Angelo Tan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • 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
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the compiler error: The constructor TrueOrFalse(String) is undefined
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!