0

Hi, I have an assignment requiring me to use the printStringArray method, but I can't find any examples on how to do so in my textbook or on the web. Can anyone provide an example please? I'd be very greatful!

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by jasimp
0

Do you have to write this method yourself? If not, I'm 99% sure its not part of the standard API. If you just have to use the method some common sense is helpful. Method's are named so that you don't really need to know how they work to use them. printStringArray most likely takes a String[] parameter, and prints it out.

Edited by jasimp: n/a

0

Ok so if I had an array called "reader", would I use the method as such: printStringArray(reader[]) ? Or would it be reader.printStringArray(reader[]) ?

0

If you are using the printStringArray() in the class it is declared in then it would be printStringArray(reader); . Otherwise you would have to know what class it is declared in, and then create an object of that type and use it that way.

public static void main(String[] args){
     ArrayPrinter printer = new ArrayPrinter(); //printStringArray method declared in this class
     String[] reader = new String[5];
     printer.printStringArray(reader);

Edited by jasimp: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.