#What do operators use?
1 messages · Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
If you are going to use mathematical operations with the numbers, you should not use string. Int is for whole number, numbers that has not decimal part like 1, 65, 998. If you are dealing with decimal number, number like 1.55, 99.69 then use double.
Since it is a calculator, and you can get decimal numbers from divison, you should use double
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Syntax error on token "+", Expression expected after this token
I get this error when I try to run the program, I dont know what +, -, *, / get assigned as
I think you want to store the operator like +, -, *, /
Yea, I want to store them
oh okay, thank you
then you can use switch statement, or if condition
i bet you know how to read the input?
yea
brilliant, good luck 
note that
when you compare string
you do not use "==" in java
do you learn that in class, don't you?
nope, didnt know that
TL;DR: Comparing some types with ==, (especially String references) can have confusing results. Always use a.equals(b) for Strings.
A variable's type is either a primitive or a reference:
- Primitive values are, for example,
0or1forint,trueorfalseforboolean,'a'or'*'forchar... - Reference values are either
nullor a reference to an object. eg The value ofsinString s = "Foo"is reference to aStringobject, not the object itself.
Using == compares the values of two variables. If two reference values are the same, they refer to the same object or are both null.
Using a.equals(b) calls a method on a that compares its contents to the object referenced by b. You are asking if the two objects are alike.
Imagine you know the following three people:
janebob- Bob's identical twin brother
michael, also known asmike.
The following are examples of using == and .equals:
jane == bob- false. They are not the same personjane.equals(bob)- false. They are not alikebob == michael- false. They are not the same personbob.equals(michael)- true. They are alikemichael == mike- true. They are the same person
Strings are special in Java and, because of this, comparing references to Strings can be surprising. Though there are rare cases where it is useful and necessary to use == with String references, you should almost always be using .equals(Object) to compare the Strings of two references. For two strings a and b use a.eqauls(b) rather than a == b.
Note: a.equals(b) is intended to see if the two objects referenced by a and b are alike. How alike they must be depends on the implementation of equals for the class of a. The default implementation of equals, for a class extending Object, has the same behaviour as using ==.
ahh I get it now
good luck, have fun
wait that fixed the next problem I was gonna have LOL
thank you
alright im gonna close this now

(I dont know how to close it)