Showing posts with label Function in Java. Show all posts
Showing posts with label Function in Java. Show all posts

Friday, 18 July 2014

Write a Program in Java Which Make a Function of Multiplication of Two Numbers:

Structure of the Problem Requirements

Function is very Important term in Programming . Functions Could be use in your Code with in Code Boundary Multiple time which save your time and Code 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
Java Functional Programming