O'Reilly logo

Java Programming by Hari Mohan Pandey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6 Functions in Java

6.1 INTRODUCTION

A function is a self-contained block of code written once for a particular purpose, but can be used again and again. It is a basic entity for Java programming language. Even the execution of the program starts from the main function. It is the basic building block for modular programming.

Depending on the parameters and return type (discussed later on), functions are classified into four categories:

1.   No return type and no arguments/parameters.

2.   No return type but arguments/parameters.

3.   Return type but no argument/parameters.

4.   Return type with argument/parameters.

All the above categories except the third one are discussed in this chapter. The third category is discussed in the chapter titled ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required