Pho3nix
The Legend
Hi,
Now.. I have another class B. Which way is the best way to use answer. Declare the variable or call super.getAnswer() multiple times in same class.
Apologies for the rubbish code. Just looking for opinions on this
Code:
class a
{
private String answer = "ham";
public String getAnswer(){
return this.answer; }
}
Now.. I have another class B. Which way is the best way to use answer. Declare the variable or call super.getAnswer() multiple times in same class.
Code:
//example 1
String random = super.getAnswer();
//example 2
return System.out.println(super.getAnswer());
Apologies for the rubbish code. Just looking for opinions on this
Last edited: