我已经看过很多CFG示例,但是它们都是过程内的。对于通常称为调用图的过程间CFG,我没有找到任何帮助。如何为以下代码绘制CFG?
public class AreaShape {
public static void main() {
Shape Obj = new Shape();
int i = 0;
while(i != 5) {
System.out.println("You can enter 1 or 2 as your choice");
System.out.println("Enter 1 to calculate the area of square");
System.out.println("Enter 2 to calculate the area of rectangle");
Scanner sc = new Scanner(System.in);
i = sc.nextInt();
switch (i)
{
case 1:
System.out.println("Area of Square =" + Obj .area(5));
break;
case 2:
System.out.println ("Area of ractangle: " + Obj .area(5,6));
break;
default:
System.out.println("Enter valid number");
break;
}
}
}
}
public class Shape {
int area(int l) {
int a = l*l;
return a;
}
int area(int l, int w) {
int a = l*w;
return a;
}
}