Tutorial Topics
JAVA Constructor and Destructor JAVA Byte Code
JAVA Methods - Java
5287    Arnab De    01/07/2017

What is Methods?

Methods or functions are the collection of statements in a group. It perform the specific goal as per requirement.

Methods are two types

  1. Build-in: These types of methods are pre written in the java development kit (JDK). Programmer can easily access these methods as per requirement.
  2. Users define: These types of methods are written by the programmer as per their requirement.

Explain function prototype of java?

The basic structure of a java method is called function prototype in java.

Function Prototype
Function Prototype

Part of the function prototype

  1. Access-specifier: This part of the function prototype is not mandatory. The value of the access-specifier will be
    1. default
    2. public
    3. private
    4. protected

If we don’t specifying any value, then the value will be default.

  1. Modifier: This part of the function prototype is also not mandatory. In general case we use the keyword static as a modifier. But we can use some other values like, final, abstract, synchronized and volatile.
  2. Return type: Any function of Java may or may not return a value. The data type of this value will be return type of the function. These types will be any primitive data type, reference type or void (if no value returns).
Note: function cannot return multiple values anyway.
  1. Function Name: This name will require when we try to invoke the function or method.
  2. Parameter: This is a list of parameters separated by comma (,). The types of the parameter will be a primitive data type or reference data type. This list is also known as function signature.

What is actual parameter and formal parameter?

When we call a method from another, then those parameters used to call the methods are known as actual parameter and those parameters used to hold the passing values are known as formal parameters.

Actual Parameter and Formal Parameter
Actual Parameter and Formal Parameter

Differentiate between call by value or pass by value and call by reference or pass by reference.[ICSE 2012]

Call by value means, a copy of the data item is passed to the method (Assume you pass a zerox copy of the note to your friend. If your Friend make any change on it then it will not reflect on your original copy). Generally variable of primitive data types are passes call by value.
Call by reference means a reference of the original data item is passed. No copy is made (Assume you pass your original note to your friend. If your Friend make any change on it then it will reflect on your original copy). Generally reference types are passed by reference.

JAVA Constructor and Destructor JAVA Byte Code
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Swami Vivekananda
All that man has to do is to take care of three things; good thought, good word, good deed.
Swami Vivekananda
Today So Far
Total View (Lakh)
26/05/2018     42033
01/01/2018     36004
28/06/2017     34089
25/06/2018     33448
02/08/2017     32401
01/08/2017     26868
06/07/2017     26791
15/05/2017     26418
14/07/2017     21855
21/04/2018     20717