1

I know that some programming languages require methods that are referenced/called by other methods to be declared before the caller in the code. For example:

private Method1(in){
  Return in *5;
}
Private Method2(paycheck){
  Return Method1(paycheck);
}

would be OK but,

Private Method1(paycheck){
  Return Method2(paycheck);
}
Private Method2 (in){
  Return in *5;
}

Would fail.

Is Java, and/or Android specific Java, one of these languages?

Karæthon
  • 33
  • 8
  • For methods, classes, no. For variables, still a yes. See https://stackoverflow.com/questions/14624919/illegal-forward-reference-java-issue – TWL Jan 26 '19 at 00:24
  • 1
    shouldn't be to hard to test.... – user85421 Jan 26 '19 at 00:37
  • Funny I looked first to see if this had been asked but that order of declaration one did not come up, I'd guess because i didn't use declaration in my search.... – Karæthon Jan 26 '19 at 00:42

1 Answers1

0

No, in Java and other Android languages (Kotlin, Dart) doesn't do compiling like C, it's okay to write methods or even variables anywhere inside the class.

Renziera
  • 81
  • 4