"An attempt to call a field (rather than a method)" What is the difference between these two???
simple english please I'm confused enough as it is!

Recommended Answers

All 2 Replies

A field is a variable that resides inside an object.


A method is a function that resides inside an object.


Notice that methods have the parenthesis at the end. These are used to enclose paramenters.

fooObject.multiply(num1, num2);

They are left empty if the method does not expect parameters.

as scru mentioned a field aka property, variable or parameter that holds a value or collection of values. You can assign values to and get values from these types of objects.

A method on the otherhand is a piece of executable code. It may return nothing (void) or return a value. Typically you will use a method to cause something to happen such as populate some component on your form, or carry out any number of tasks.

To understand some of these basics, you should grab one of the many wonderful programming books. All programming languages have the basic concepts of storing data in some variable, and calling methods (also called functions and procedures in different languages).


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.