Methods

A method is set of code which is referred to a name(identifier) and can be called at any point in a program simply by utilizing the methods name.

Each method contains a name. When that name is encountered in the program, the executions of the program branches to the body of the method. When method is completed, execution returns to the area of the program codes from which it was called, and the program continues to the next line of code. A JAVA program is a collection of different method. 

What is method ?

A method is sub program that acts on data & often returns a value.

Types of method 

1.predefined methods
2.user defined methods

Predefined methods

Predefined methods are the methods in any programming languages that already defined as the creators of the programming language. Just like finding a square roots. The programs for calculating the squares root is written by the developers who developed the programming language.

There are many predefined methods in Java that are ready to be used by the just calling the name of the functions.

These collections of predefined methods are known as method libraries. And these method are known as Library methods.

User Defined Method 

An user can also define methods inside in a class. Such methods are known as USER DEFINED METHOD. Each methods perform a certain function in a program with a finite set of statement which is written by the programmer (user).


These are of two types:-

1:- Static method
2:- Instance method.


Subscribe my YouTube channel:-CLICK HERE
                          

Post a Comment

Previous Post Next Post