What is method?

12th Apr 2021, 2:28 PM
Youngcommander Youngcommander
Youngcommander Youngcommander - avatar
6 Answers
+ 8
Hello there! :) Here an informative article about methods: https://webolutiondesigns.com/what-is-a-method-function/ Remember to Google your questions sometimes too :D
12th Apr 2021, 2:43 PM
Matthew - avatar
+ 1
None of the other answers are specific enough. Yes, a method is another name for a function, but it's usually used in a specific context. This may be a little beyond your scope for right now, but it's important to know, so I'll go ahead and explain. CLASSES: In programming (and specifically something called *Object-Oriented* Programming), a class is a sort of general "plan" for something. A class for a car might include that all cars have: - Four wheels - A windshield - An engine in front (let's ignore cars that don't follow this rule for now!) - A place for the driver and passengers to sit. - A 5th wheel, known as a "steering wheel". - A way move forward - A way to steer. Now, of course different cars might handle this differently, but in general every car can be said to "fit" in this general plan. In programming terms, we like to say that every car has certain adjectives that describe it - we call these *properties* - and certain verbs that it can do - we call these *methods. So a method is a kind of function, but it's usually in the context of a class. So, for example in JavaScript: var myFunc = function(name){ console.log("Hi! My name is"+name+"!"); } is *not* a method. It's not part of a class. However, in the following Person class: class Person{ constructor(name){ this.name = name; } sayHi:function(){ console.log("Hi! My name is"+this.name+"!"); } } "sayHi()" *is* a method: it's something that stuff created with the Person class can "do".
12th Apr 2021, 4:56 PM
HealyUnit - avatar
Hi! you will learn about this in lesson 28.1 of your Java course
12th Apr 2021, 2:32 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
In object Oriented Programming, function is called method.
12th Apr 2021, 2:34 PM
CHANDAN ROY - avatar
Just another way to name functions. Function are this stuff with the ( )
12th Apr 2021, 3:14 PM
R.P. - avatar
- 1
Youngcommander Youngcommander In simple language methods are that which performs some task..
13th Apr 2021, 6:45 AM
A͢J - avatar