Skip to main content

Posts

Showing posts from 2018

How to use Methods in Java.

#Topic-9 Previous topic (8) we have discussed about what is Class, Constructors and this keyword in Java.   If you have not gone through that topic, click this link Class, Constructors and this keyword in Java. In this section we will discuss about How to use Methods in Java. Method: Method is a collection of statements that are grouped together to perform an operation. System.out. println() – it is a method, it execute several statement in order to display a message(internally). Two types: 1. Methods which does not return value 2. Methods which have return value 1. Methods which does not return value: It must proceeded by void keyword. 2. Methods which return value: It has 2 types: a) Methods which have parameters b) Methods which do not have parameters a) Methods which have parameters: We can avoid creation of constructor in order to use parameterized method provide values , We have to create mu...