Java Syntax Error -
what wrong code? have error concerning scanner part of it. have add "more details be4 can post question, it.
import java.util.scanner class rectangle { double width; double length; double findarea(double a, double b) { width=a; length=b; return a*b; } } public class area { public static void main(string args[]) { { system.out.println("enter dimensions of square."); scanner x = new scanner(system.in); scanner y = new scanner(system.in); } { rectangle objrect = new rectangle(); system.out.println(objrect.findarea(x, y)); } } }
you passing 2 scanner
objects method findarea
expects 2 double
values; won't work. should have 1 scanner
object, should able obtain double
values can pass in findarea
method.
Comments
Post a Comment