So, my question is the following: I get an error message on line 12, which I want to solve, but did not find the result for. I use Eclipse to run and write my code.
This is what I do:
Why is this not working? In addition, I tried to run it in CMD outside of Eclipse, but without success.
import java.util.Scanner; class apples { public static void main(String args[]) { Scanner scan = new Scanner(System.in); System.out.println("Select one of the following(absolute,ceil,floor,max,min,power,squareroot): "); String code = scan.nextLine(); if (code.contains("absolute")) { System.out.println("Enter a number to get absolute value: "); Scanner num1 = new Scanner(System.in); double numberone; double numberone1 = num1.nextDouble(); System.out.println(Math.abs(numberone1)); } } }
user1817311
source share