why my java eclipse out like this ,this program runnable on mac..
public class AreaRectangle { public static void main (String[] args) { double length = 0: double width = 0: double area: length = Length (length): width = width(width): area = area (length, width): displayData (length, width, area): System, exit(0): } public static double length (double length){ Scanner keyboard = new Scanner(system.in): System.out.print (“Enter the your length: “): return length = keyboard.nextDouble(): } public static double width (double width){ Scanner keyboard = new Scanner(System.in): System.out.print (“Enter the your width: “): return width = keyboard.nextDouble();} public static double area (double length double width){ double area: area = length * width: System, out.println(area) return area: } public static double displayData (double length, double width, double area){ System out println(“the data of this program includes length “+length+” width” +width +”Area” + area): return area: } }
Expert Answer
/* According to your image there is some another class Methods .java. remove it and recompile it.
Your code is correct and running in my IDE intelliJ and Eclipse both perfectly. So try to reconfigure your ide. Problem may solved.
still you face problem. Leave comment. thanks.
*/
//This is your program
import java.util.Scanner; public class AreaRectangle { public static void main(String[] args) { double length=0; double width=0; double area; length = length(length); width=width(width); area = area(length,width); displayData(length,width,area); System.exit(0); } public static double length(double length) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter the your length: "); return length=keyboard.nextDouble(); } public static double width(double width) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter the your width: "); return width = keyboard.nextDouble(); } public static double area(double length, double width) { double area; area = length*width; System.out.println(area); return area; } public static double displayData(double length, double width, double area) { System.out.println("The data of this program includes length "+length+ " width "+width+ " Area "+area); return area; } }
//Output:—>