Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: passing a string and int array into a static method

  1. #1
    Member
    Join Date
    Apr 2011
    Posts
    32
    Thanks
    20
    Thanked 0 Times in 0 Posts

    Default passing a string and int array into a static method

    Hello everyone, Is there anyway of passing a String array and also an int array through a same static method? If so, how do I do it Thank you!


  2. #2
    Member OutputStream's Avatar
    Join Date
    Apr 2011
    Posts
    32
    My Mood
    Fine
    Thanks
    1
    Thanked 4 Times in 3 Posts

    Default Re: passing a string and int array into a static method

    Do you mean like this:
    public static void doSomething(String[] strings, int[] integers) {
    //do something
    }

    Or should the method just accept one parameter?
    public static void doSomethingElse(Object[] objects) {
    //do something else here
    }

  3. The Following User Says Thank You to OutputStream For This Useful Post:

    u-will-neva-no (May 8th, 2011)

  4. #3
    Member
    Join Date
    Apr 2011
    Posts
    32
    Thanks
    20
    Thanked 0 Times in 0 Posts

    Default Re: passing a string and int array into a static method

    The top line did the trick, thank you very much!!

Similar Threads

  1. non-static method cannot be referenced from a static context
    By Kaltonse in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 21st, 2010, 06:51 PM
  2. Replies: 10
    Last Post: September 6th, 2010, 04:48 PM
  3. passing string into method
    By tabutcher in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 26th, 2010, 08:43 AM
  4. Passing JTextField as String parameter
    By Christophe in forum Java Theory & Questions
    Replies: 3
    Last Post: April 11th, 2010, 05:32 AM
  5. Static method
    By kalees in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 20th, 2009, 10:10 AM