Illustrating the function call stack - Java Object Oriented Design

Java examples for Object Oriented Design:Method

Description

Illustrating the function call stack

Demo Code

public class Main {

    static double G(double x) {
        double result;
        result = Math.pow(x, 2.5);
        return result;
    }/* ww  w.j a  v a2 s.c  o  m*/

    static double F(double x) {
        double result;
        result = 1.0 + G(x * x);
        return result;
    }

    public static void main(String[] args) {
        double y;
        y = F(5.0);
        System.out.println("y=" + y);
    }
}

Result


Related Tutorials