Introduction to Java Methods | Java Programming for Beginners | G C Reddy |

143 Просмотры
Издатель
Introduction to Java Methods
What is Method?
Java Method is a block of code/Set of statements/steps/instructions that are grouped together to perform certain actions.
You can pass data known as parameters into methods
Methods are equivalent to Functions in Structured Programming (Ex: C Language)
In Structured Programming, we have Functions (Built-in Functions and User-defined Functions)
In Object-Oriented Programming (Ex: Java) we have Methods (Built-in Methods and User-defined Methods)
In Python, we have both Functions and Methods
When we choose Methods?
Whenever we want to perform an operation multiple times then we choose methods
Advantages of Methods:
1. Code Reusability
2. Code maintenance is easy
Категория
Язык программирования Java
Комментариев нет.