r/learnjava • u/jgonzalez-cs • Feb 08 '22
Does Java really not have functions?
Hi, I'm brand new to Java.
I googled "Does Java have functions" and the first/top result says, "There are no functions per se in Java. All you've got is methods."
I'm not sure what the latter part of that means, but you really can't create functions in Java?
Thanks, sorry for the noob question
7
Upvotes
7
u/popey123 Feb 08 '22 edited Feb 08 '22
A function can be accessed without object whereas method does.
Because java is a full OOP langage, it doesn t have function.
Technically, when you use a static method, you may be implicitly calling the class from where it is declared.
public class Main {
public static main().... {
Main.a(); // or a()
}
a static method A()
}
But it doesn t matter. What is more important is the diff between methods (return) and procedures (void)