Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

pottersheep

  • 4 years ago

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

  • This Question is Closed
  1. pottersheep
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  2. heisenberg
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    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.

  3. pottersheep
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks

  4. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy