0

I still do not understand why in Java a method can be used and then be written?

24th Jan 2017, 11:47 PM
johan buitrago
johan buitrago - avatar
3 Antworten
+ 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
25th Jan 2017, 12:54 AM
Leonida17st
Leonida17st - avatar
0
public class Program { public static void main(String[] args) { func(); } public static void func(){ System.out.println("txt"); } } you mean this?
25th Jan 2017, 12:06 AM
Leonida17st
Leonida17st - avatar
0
yeah,the order of the sentence should be different. why it's like this ?
25th Jan 2017, 12:19 AM
johan buitrago
johan buitrago - avatar