Ask Experts Questions for FREE Help !
Ask
    kilroy's Avatar
    kilroy Posts: 2, Reputation: 1
    New Member
     
    #1

    Jul 23, 2003, 08:04 AM
    Java: using an array from the main in a method
    I have the array names[][] in the main of my program and I want to use it in a method FindName..
    How would I wright the method header and the call to the method in the main?
    kilroy's Avatar
    kilroy Posts: 2, Reputation: 1
    New Member
     
    #2

    Jul 23, 2003, 08:44 AM
    Java: using an array from the main in a method
    The array is a string array
    Deschwann's Avatar
    Deschwann Posts: 1, Reputation: 2
    New Member
     
    #3

    Jul 30, 2003, 12:37 PM
    Java: using an array from the main in a method
    OK, first of all you can't call the method directly from the main unless your method is static.

    example

    public class className{

    static method(String[][] name){

    }

    public static void main(String args[]){

    String name[][];
    //fill the string here
    method(name);
    }
    }

    your second choice is to make an object of your class and use the method

    public class className{

    public method(String[][] name){

    }

    public static void main(String args[]){

    String name[][];
    //fill the string here

    className copyOfClass = new className();
    copyOfClass.method(name);
    }
    }

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Statistical method to use [ 1 Answers ]

Hi, I am trying to figure out which method to use to find steady state. So I have data that was collected at 38 time points for 12 individuals. I am supposed to find the time point at which steady state was reached. I want to know what is the best method to answer this question. I have tried to...

Perpetual inventory method [ 1 Answers ]

I can't seem to figure out how to journalize some information using the Perpetual inventory method. Here is the information. a) Sold merchandise on account, for $10,000. The cost of the merchandise sold was $4,500. b) Sold merchandise to customers who used MasterCard and VISA, $8,500. The...

Swish Method video [ 1 Answers ]

Hey how can you buy or how can you ge the video (Swish Method) it cost 30 $ american... but how can a person that lives in the ghetto and is poor how can he get it?? Downlod it or how and the other video is better basketball shooting please help if you know were to download it please thankx

Java Error: array required, but PRmList found [ 2 Answers ]

Here is my code: I get the error: Array required, but PRmList found. Any help would be GREATLY appreciated. Thanks! Public class PRm { Private String PRm; Private String movieTitle; Private String movieRating; Private int seats;


View more questions Search