how can i write a java code to display data based on the user input. The data displayed is not input by the...











up vote
-6
down vote

favorite












e.g how to write a code that will display a string based on the input by users. N/B the strings are already initialized within the code










share|improve this question















closed as unclear what you're asking by Unheilig, Matsemann, DaveyDaveDave, gnat, Grimthorr Nov 9 at 10:40


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.



















    up vote
    -6
    down vote

    favorite












    e.g how to write a code that will display a string based on the input by users. N/B the strings are already initialized within the code










    share|improve this question















    closed as unclear what you're asking by Unheilig, Matsemann, DaveyDaveDave, gnat, Grimthorr Nov 9 at 10:40


    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

















      up vote
      -6
      down vote

      favorite









      up vote
      -6
      down vote

      favorite











      e.g how to write a code that will display a string based on the input by users. N/B the strings are already initialized within the code










      share|improve this question















      e.g how to write a code that will display a string based on the input by users. N/B the strings are already initialized within the code







      java






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 11 at 18:02

























      asked Nov 9 at 8:02









      Rthirteen

      12




      12




      closed as unclear what you're asking by Unheilig, Matsemann, DaveyDaveDave, gnat, Grimthorr Nov 9 at 10:40


      Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






      closed as unclear what you're asking by Unheilig, Matsemann, DaveyDaveDave, gnat, Grimthorr Nov 9 at 10:40


      Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          I think what you are looking for is .equals() method of String class which can compare two strings. For example:



          if(scanner.next().equals(a)) {
          // do something
          }





          share|improve this answer




























            up vote
            0
            down vote













            I'm not very clear about your question. Do you mean user will input a variable name, and the program need to display the value of this variable?



            If my guess correct, you just need a map. For example, if your variable value type is Integer, you can create:
            Map memory = newHashMap();



            and put your initialized variable into "memory" by: memory.put("var", 1).



            to retrieve the variable: if ( memory.containsKey("var") ) return memory.get("var");






            share|improve this answer





















            • the user will input a variable possible lets say a dog disease symptom and the program with already initialized data for diseases will display the disease based on the symptom input
              – Rthirteen
              Nov 9 at 8:14










            • If you mean human language understanding, you can try to google "NLP", it's part of AI scope.
              – cuble
              Nov 9 at 8:26










            • The Map define code should be: Map<String, Integer> memory = newHashMap<String, Integer>();. I'm not familiar with the post edit rules
              – cuble
              Nov 9 at 8:44


















            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            I think what you are looking for is .equals() method of String class which can compare two strings. For example:



            if(scanner.next().equals(a)) {
            // do something
            }





            share|improve this answer

























              up vote
              1
              down vote













              I think what you are looking for is .equals() method of String class which can compare two strings. For example:



              if(scanner.next().equals(a)) {
              // do something
              }





              share|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote









                I think what you are looking for is .equals() method of String class which can compare two strings. For example:



                if(scanner.next().equals(a)) {
                // do something
                }





                share|improve this answer












                I think what you are looking for is .equals() method of String class which can compare two strings. For example:



                if(scanner.next().equals(a)) {
                // do something
                }






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 9 at 8:08









                Naeem Khan

                649




                649
























                    up vote
                    0
                    down vote













                    I'm not very clear about your question. Do you mean user will input a variable name, and the program need to display the value of this variable?



                    If my guess correct, you just need a map. For example, if your variable value type is Integer, you can create:
                    Map memory = newHashMap();



                    and put your initialized variable into "memory" by: memory.put("var", 1).



                    to retrieve the variable: if ( memory.containsKey("var") ) return memory.get("var");






                    share|improve this answer





















                    • the user will input a variable possible lets say a dog disease symptom and the program with already initialized data for diseases will display the disease based on the symptom input
                      – Rthirteen
                      Nov 9 at 8:14










                    • If you mean human language understanding, you can try to google "NLP", it's part of AI scope.
                      – cuble
                      Nov 9 at 8:26










                    • The Map define code should be: Map<String, Integer> memory = newHashMap<String, Integer>();. I'm not familiar with the post edit rules
                      – cuble
                      Nov 9 at 8:44















                    up vote
                    0
                    down vote













                    I'm not very clear about your question. Do you mean user will input a variable name, and the program need to display the value of this variable?



                    If my guess correct, you just need a map. For example, if your variable value type is Integer, you can create:
                    Map memory = newHashMap();



                    and put your initialized variable into "memory" by: memory.put("var", 1).



                    to retrieve the variable: if ( memory.containsKey("var") ) return memory.get("var");






                    share|improve this answer





















                    • the user will input a variable possible lets say a dog disease symptom and the program with already initialized data for diseases will display the disease based on the symptom input
                      – Rthirteen
                      Nov 9 at 8:14










                    • If you mean human language understanding, you can try to google "NLP", it's part of AI scope.
                      – cuble
                      Nov 9 at 8:26










                    • The Map define code should be: Map<String, Integer> memory = newHashMap<String, Integer>();. I'm not familiar with the post edit rules
                      – cuble
                      Nov 9 at 8:44













                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    I'm not very clear about your question. Do you mean user will input a variable name, and the program need to display the value of this variable?



                    If my guess correct, you just need a map. For example, if your variable value type is Integer, you can create:
                    Map memory = newHashMap();



                    and put your initialized variable into "memory" by: memory.put("var", 1).



                    to retrieve the variable: if ( memory.containsKey("var") ) return memory.get("var");






                    share|improve this answer












                    I'm not very clear about your question. Do you mean user will input a variable name, and the program need to display the value of this variable?



                    If my guess correct, you just need a map. For example, if your variable value type is Integer, you can create:
                    Map memory = newHashMap();



                    and put your initialized variable into "memory" by: memory.put("var", 1).



                    to retrieve the variable: if ( memory.containsKey("var") ) return memory.get("var");







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 9 at 8:10









                    cuble

                    15617




                    15617












                    • the user will input a variable possible lets say a dog disease symptom and the program with already initialized data for diseases will display the disease based on the symptom input
                      – Rthirteen
                      Nov 9 at 8:14










                    • If you mean human language understanding, you can try to google "NLP", it's part of AI scope.
                      – cuble
                      Nov 9 at 8:26










                    • The Map define code should be: Map<String, Integer> memory = newHashMap<String, Integer>();. I'm not familiar with the post edit rules
                      – cuble
                      Nov 9 at 8:44


















                    • the user will input a variable possible lets say a dog disease symptom and the program with already initialized data for diseases will display the disease based on the symptom input
                      – Rthirteen
                      Nov 9 at 8:14










                    • If you mean human language understanding, you can try to google "NLP", it's part of AI scope.
                      – cuble
                      Nov 9 at 8:26










                    • The Map define code should be: Map<String, Integer> memory = newHashMap<String, Integer>();. I'm not familiar with the post edit rules
                      – cuble
                      Nov 9 at 8:44
















                    the user will input a variable possible lets say a dog disease symptom and the program with already initialized data for diseases will display the disease based on the symptom input
                    – Rthirteen
                    Nov 9 at 8:14




                    the user will input a variable possible lets say a dog disease symptom and the program with already initialized data for diseases will display the disease based on the symptom input
                    – Rthirteen
                    Nov 9 at 8:14












                    If you mean human language understanding, you can try to google "NLP", it's part of AI scope.
                    – cuble
                    Nov 9 at 8:26




                    If you mean human language understanding, you can try to google "NLP", it's part of AI scope.
                    – cuble
                    Nov 9 at 8:26












                    The Map define code should be: Map<String, Integer> memory = newHashMap<String, Integer>();. I'm not familiar with the post edit rules
                    – cuble
                    Nov 9 at 8:44




                    The Map define code should be: Map<String, Integer> memory = newHashMap<String, Integer>();. I'm not familiar with the post edit rules
                    – cuble
                    Nov 9 at 8:44



                    這個網誌中的熱門文章

                    Tangent Lines Diagram Along Smooth Curve

                    Yusuf al-Mu'taman ibn Hud

                    Zucchini