0
Can't find the error in my java
Simple calculator https://code.sololearn.com/cL3efUn15iDR/?ref=app
6 Answers
+ 3
Calculator:
š AS SAID BEFORE:
1. Don't import things you do not use, e.g. your line 3
š AS SAID BEFORE:
2. Do not put random blank spaces in methods, e.g. it's
System.out.println("something")
not
System. out.println ("something")
3. Write the method names correctly: It's .nextDouble() and .nextLine()...
4. Do not compare strings with == but with the .equals() method
0
Can't understand num 4
0
Please explain
0
Remember that strings are not a primitive type in Java, like integers or characters. String are objects. When you compare two objects with '==', it will compare those objects' memory adresses, not their values.
0
Ok i understand that
Now how can i write it
0
Choice.equals("+")
Alternatively you can use .nextChar() instead of .nextLine() and compare values as you're used to