0
I still do not understand why in Java a method can be used and then be written?
3 Answers
+ 4
well it doesent have to be..you can write first and then call it...it's same thing...but you are asking what is usage of this?
well imagine yourself doing some big program like 1000lines...at some time you will come to the point where you will need to call function but you didnt write it yet..so you wont do that now you will just type name so you know that there must be function in that line...and when you finish your big program you just type code for small function that you need to call
0
public class Program
{
public static void main(String[] args) {
func();
}
public static void func(){
System.out.println("txt");
}
}
you mean this?
0
yeah,the order of the sentence should be different.
why it's like this ?