import java.util.Scanner;
public class Rect
{double W,L;
public Rect()
{
Scanner scan=new Scanner(System.in);
System.out.print("width:");
double W=scan.nextDouble();
System.out.print("length:");
double L=scan.nextDouble();
}
public void computeArea()
{
System.out.println("矩形面积="+W*L);
}
public static void main(String [] args)
{ Rect R=new Rect();
R.computeArea();
System.exit(0);
}
}
这个程序运行Scanner赋的值不能达到目的。。。