Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

Java Programming Project HELP

OpenStudy (anonymous):

OpenStudy (rsmith6559):

Except for the long explanation, it seems fairly straight forward. As you're designing your program, just deal with a single direction at a time. When in doubt, break it down more.

OpenStudy (e.mccormick):

How far did you get? Where did you have a problem? Is there some part of the instructions that you got lost on? Without knowing these sorts of things, it is impossible to help you. We are not going to write your program for you, but we can give lots of tips, help with errors, and things like that.

OpenStudy (anonymous):

I don't get part 2. How would you create a static method called printArray with one parameter of type int[] named arr?

OpenStudy (anonymous):

This is all I have: import java.util.Scanner; public class ArrayPrinter { Scanner input = new Scanner (System.in); }

OpenStudy (e.mccormick):

Well, a static method is one that does not need to be instantiated. Let me explain that really quick just in case... Normal objects and their methods need an instance, an object, to work and static ones don't. For example, if you made an object for a student, you would need to make a particular student object to put a name on it, a student id, and so on. A static method does not need all this. The square root method is a really good example of this. You just pass it the proper input and get output. You don't need to make an instance of a root object or anything like that. You just tell it what you want the root of and it does it. In this case, they say they want a static method that takes in an array of integers and then prints them out with formatting. So the only parameter it needs is the input array. All the rest of the instructions are about how to format it. So if you passed it 2, 3, 4, and 5 in an array, it would print out: [2, 3, 4, 5]

OpenStudy (e.mccormick):

Oh, and you will not be using a scanner in this method. You pass it input from another method.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!