I'm new with codes and i need help passing something from c to java RRS feed

  • Question

  • to be short, as i dont know how to use c#, but i understand the basics, how do i pass this:

            var unitsMap = new[] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };

            var tendsMap = new[] { "zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" };

    to java.

    I'm searching and "var" doesnt exist on Java, but also if i want to make an array, it has to be diferent that that (or at least, where i'm learning it's diferent).

    The code is about making numbers to letters 1=one, to millions.

    plus, if you explain me why and how, you will have my eternal gratitude.

    pd: english is not my mother language, i'm sorry for the spelling, really sorry.

    Sunday, June 10, 2018 6:05 PM

All replies

  • In java:

    string[] unitsMap = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };

    string[] tendsMap =  { "zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" };

    Sunday, June 10, 2018 7:18 PM
  • You cannot pass direct from C# to Java, they use both intermediate code, but those are different.

    a var (only usable in a method) is a keyword, which replaces a type, if the type can be found from the following expression. 


       var unitsMap = new[] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };

    It is an easy way of writing of 

       string[] unitsMap = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };
    The resulting intermediate code will be the same.


    Sunday, June 10, 2018 8:15 PM
  • It's just string data that is comma delimited. You can't write it out to  a delimited text file and read the text file?
    Monday, June 11, 2018 1:11 AM
  • Hi ParisStrom,

    Thank you for posting here.

    If you want to convert C# to java, you could try to use some tools.

    Convert C# to java

    Converts existing Java-language code into Visual C#

    If you need further help for java, you could post your question is StackOverFlow.

    Best Regards,


    Note: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. 

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, June 11, 2018 6:15 AM
  • Yes, it is string array (string item delimited by comma). It is constant array, items will not be changed so it is not necessary to have it in file.
    Monday, June 11, 2018 9:00 AM