How to find factorial without using Recursion or loop in java?
问题 I need to find the factorial in java without using loop or recursion ? So if there is any way then please help . Thanks 回答1: Slightly impractical but no explicit loop anywhere. import javax.swing.Timer; import java.awt.event.*; import java.util.concurrent.ArrayBlockingQueue; public class Fac { public static int fac(final int _n) { final ArrayBlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(1); final Timer timer = new Timer(0, null); timer.addActionListener(new ActionListener() {