Ask your own question, for FREE!
Computer Science 9 Online
OpenStudy (pottersheep):

Writing a simple program in Java.... Is there anyway I can make a variable strand for more than one thing?

OpenStudy (pottersheep):

I want to make a string equal to either one of these : hat, pool, math, bita, sheep, cap, dog, cat, one, eat, ear;

OpenStudy (heisenberg):

not really sure what you want to do here. if you want to constrain the variable's value to a certain set of values (e.g. {hat, pool, math, ...}), then you could use enums to do so. but the variable will only stand for "one thing" still.

OpenStudy (pottersheep):

Thanks

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!