Results 1 to 2 of 2
Thread: Arrays & Methods
- 12-10-2008, 07:22 PM #1
Member
- Join Date
- Nov 2008
- Posts
- 20
- Rep Power
- 0
Arrays & Methods
Ok what I have is the main method where a user inputs how many numbers they want to input in the next section, this works fine and so does inputting the numbers but how do I print the array out and process the array from method to method?
Code is below
Java Code:import javax.swing.*; public class Arrays { public static void main(String[] args) { String amount = JOptionPane.showInputDialog( "Enter a number"); int n = Integer.parseInt(amount); int[] numbers = new int [n]; getNumbers(n); for (int i = 0; i < n; i++) { System.out.println(i + "\t" + numbers[n]); } } public static int getNumbers(int n) { while(n > 0) { String inputNumber = JOptionPane.showInputDialog( "Enter a number"); int number = Integer.parseInt(inputNumber); n--; } return n; }
- 12-10-2008, 07:37 PM #2
Similar Threads
-
Trouble with static methods and boolean equals() methods with classes
By dreamingofgreen in forum New To JavaReplies: 8Last Post: 04-16-2012, 11:00 PM -
Need help with Arrays
By dietgal in forum New To JavaReplies: 21Last Post: 10-08-2008, 01:59 PM -
Help with Arrays
By bri1547 in forum New To JavaReplies: 4Last Post: 08-01-2008, 05:12 AM -
arrays
By hasysf in forum New To JavaReplies: 12Last Post: 07-28-2008, 02:38 AM -
Help on Arrays...
By cuellar14 in forum New To JavaReplies: 4Last Post: 07-25-2008, 08:16 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks