I have been trying to learn Java for the past few days so my my knowledge is incredibly basic.
I cannot for the life of me work out how to search for the answer to my question online.
I am trying to create a very simple currency converter. The user inputs a currency symbol, then using an IF statement I want to specify the value of ‘currencyamnt’
I want to essenially
if ( currency = "£" )
{
currencyamnt = 1;
}
currency being a string and currencyamnt being an float.
This doesnt work and i am not sure why..
In java you have to use the .equals to check if a string is equal to some other string. In something like c++ this is valid but for java instead of doing this:
try
Edit:
The original code looked like this:
Which would have set currency to £ instead of checking whether it was equivalent text which is something to always look out for when coding!