İç İçe Fonksiyon

  1. Yöntem

static int f(int x){
return 2*x+4;
}
static int g(int x, int y){
return x+y+2;
}
public static void main(String[] args) {
// TODO code application logic here
System.out.println(f(g(2,3)));

}

run:
18
BUILD SUCCESSFUL (total time: 0 seconds)

iç içe

2.Yöntem

static int f(int x){
return 2*x+4;
}
static int g(int x, int y){
return f(x+y+2);
}
public static void main(String[] args) {
// TODO code application logic here
System.out.println(g(2,3));

}

run:
18
BUILD SUCCESSFUL (total time: 0 seconds)

l.png

Yorum bırakın