it was good though I slept most of the times lol. It's high alert in our city for next 2 days because as per weather experts, we can face a mini tornado today and tomorrow
Intent intent = CheatActivity.newIntent (QuizActivity.this, answerIsTrue); - what does this code say? from CheatActivity get method newIntent which data is in QuizActivity in answerIsTrue. Is that right? :)
each time you call new Question() you create an instance of Question
You also pass two variables
These two vars are connected to each instance, meaning:
Question q1 = new Question(somedata, false)
Question q2 = new QUestion(someotherdata, true)
q1.var2 != q2.var2
There is a chance they're the same though, but if it was i.e. a unique ID they wouldn't be
The getter is just a method that returns the value, meaning you can't modify the value directly (q2.var2 = blah isn't possible if var2 is private)
and equivalently, retrieving var2 isn't possible if it's private
Which is where the getters and setters come in
they're made to limit access, and i.e. make a var read only
If a var only has a getter, external classes can only retrieve the value
If it only has a setter (very uncommon) external classes can only set the value
All though it's very rare having a setter but not a getter, but having a getter and not a setter is fairly common
Having both is also common
So basically, the getter returns the value stored in i.e. q1 or q2
q1.getVar1() would return the value of var1 as stored in q1
This assumes non-static vars (static vars are instance-independent and have the same value regardless of which instance. All though most common practice for static vars is using Question.staticVar instead of questionInstance.staticVar)
plenty of reading.. just in a meantime still wonder how this default value: false works when getting this extras data .just cant get how does this data true and false is correctly read each time - line 8