How to Make Function in Java

Function is very Important term in Programming . Functions Could be use in your code multiple time which save your time and key-stokes a lot .In this Small and Simple Code we just tell you that how can you make a Function in Java and use it.

Source Code


import java.util.Scanner;
public class Function {

    public static void main(String[] args) {
    int x,y,z=0;
    Scanner s = new Scanner (System.in);
    System.out.println("Enter 1st Number ");
    x = s.nextInt();
    System.out.println("Enter 2nd Number");
    y = s.nextInt();
    z =  multiplication (x,y);
    System.out.println(z);
    }
    
  static int multiplication (int a, int b)
    {
        return (a*b);
    }
}

Output of the Program 

Java Function

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.

2 comments:

  1. a very good and unique way you adopt in coding ....specially the screen shoots of the program output

    ReplyDelete