Learn Pain Less

HomeOur TeamContact
What are methods in JAVA (Beginners)
Pawneshwer Gupta
Pawneshwer Gupta
March 19, 2015
1 min
What are methods in JAVA (Beginners)

Hello Readers !!!

In previous lesson I wrote about JAVA Classes. And in this lesson I will teach you about Methods. If you came from any programming language like C or C++ then keep this line in mind that functions in C or C++ language are called as Methods in JAVA programming language. So don’t get confuse about that what is methods. :/ But if you don’t have knowledge about any programming language then in simple words methods are used to combine variables, so that we can use them later anytime, and we don’t need to do the same work again and again. (I know that you don’t understud that what I am talking about). ok lets take an example.

suppose we want to add two numbers then in maths we wrote like this 14 + 25, and we do the same in programming languages. like sum = a+b or sum = 14+25. Its an easiest and small example. but if we want to find factorial of 2 numbers, then we will simply write mathematics logic to find factorial. but if we need to do this again and again, then we need to write code again and again also. but this is not good idea to do this because this will make our file to large. So here the work of methods came. If we define logic of finding factorial of 2 numbers inside method then we can use that method when we want to find factorial of another numbers and we will pass new values to that method and we will get our result.

Maybe you got an Idea that why we use methods and classes in JAVA and other programming languages. because it prevent us from rewriting same thing again and again and make coding faster.

In real-life software we mostly use Classes and Methods.

So this is just intro about Methods in JAVA Programming language.

Subscribe to our newsletter!

We'll send you the best of our blog just once a month. We promise.


methodsstarthow tojava methodsdefine methods


Pawneshwer Gupta

Pawneshwer Gupta

Software Developer

Pawneshwer Gupta works as a software engineer who is enthusiastic in creating efficient and innovative software solutions.



Social Media

Related Posts

Working with Files, Folders java
Working with Files, Folders java
March 25, 2015
1 min
Learn Pain Less  © 2024, All Rights Reserved.
Crafted with by Prolong Services

Quick Links

Advertise with usAbout UsContact Us

Social Media