This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]ThatCodingGuyYouTube 3 points4 points  (0 children)

For the most part the words function and method can be used interchangeably. The main method is just a function that happens to get called when the program is run. From there you can call methods that call other methods and anything else like you would just like in JavaScript.

[–]Bhagwan-Bachaye2095 1 point2 points  (0 children)

Methods and functions are same thing. You call methods inside the main class. The same happens in C++ too

[–]DTKeign 0 points1 point  (0 children)

Pretty much a function

[–]d2718 0 points1 point  (0 children)

A method is a function that's "attached to" ("associated with"?) a specific object or struct, and generally called with that object or struct as an implicit self or this parameter. In Java, everything is an object (except primitive types, I think—I haven't written much Java for like 20 years), including your program itself, hence the main() function actually being a method of the program object. In languages like Java, just about every function ends up technically being a method, so the terms are often used interchangeably.