Skip to content
Advertisement

Can I replace values on a single variable in Java

I have program that the user picks their products in the product menu in which after they inputted the item ID and the quantity, the program will ask if they want to buy another, if YES then the transaction repeats again and asking the same question. My central question is can I replace the value in the single variable?

JavaScript

The output must be the product id, name, quantity, and amount must be displayed in different value which shared the single variable.

Advertisement

Answer

You can use List<String> You can use String s =id+" | " + name + " | " + quantity + " | " + amount It is not clear what you can’t do.

But if you need you can create the object, and name its… Menu.

JavaScript

and in your current class, you can make something like

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement