0
Can I replace a no number String for a int?
My question is, can I replace a String as an example String="house" and give it a int valor like 1? Then, it could be easier to make a switch for me with a String. Thanks! It's in Java btw
4 odpowiedzi
+ 2
You can associate a number to a String by making an object. Use static to iterate amongst the same objects.
https://code.sololearn.com/cXbyw8PvtiaC/?ref=app
+ 3
You could create an array of objects?
String[] house = {"Small house","big house"};
System.out.print(house[1]);
+ 1
ExodialGamer -juegos y diversión no problem 👍
0
Thanks, I've not learned the arrays yet :'(