Search Results

Search found 2 results on 1 pages for 'ambidextorous'.

Page 1/1 | 1 

  • How do I pass an array to a method?

    - by ambidextorous
    Hey, I have not been able to find a proper answer on any forums about this. But how exactly do I pass an array to a class constructor? public class TestArray { String name; String[] array; public TestArray(String name, String[] anArray){ this.name = name; int len = anArray.length; this.array = new String[len]; for (int i = 0; i < len; i++) { this.array[i] = new String(anArray[i]); } } public static void main(String[] args){ String[] anArray = new String[2]; anArray[0] = new String("Test"); anArray[1] = new String("Test2"); TestArray work = new TestArray("Jordan", anArray); // How to pass the array? } }

    Read the article

  • I'm new to Java most basic question about arrays!

    - by ambidextorous
    Hey I have not been able to find a proper answer on any forums about this but how exactly do I pass an array to a class? public class TestArray { String name; String[] array; public TestArray(String name, String[] anArray){ this.name = name; int len = anArray.length; this.array = new String[len]; for (int i = 0; i < len; i++){ this.array[i] = new String(anArray[i]); } } } public static void main(String[] args){ String[] anArray = new String[2]; anArray[0] = new String("Test"); anArray[1] = new String("Test2"); TestArray work = new TestArray("Jordan", anArray?); } }

    Read the article

1