Soldato
- Joined
- 28 Nov 2005
- Posts
- 13,001
i have the following
"
import javax.swing.*;
public class arraymethod11
{
public static void main(String args[])
{
int i = 0;
int totalMark = getMarkLength(i);
}
public static int getMarkLength(int i)
{
String input = JOptionPane.showInputDialog(null,
"Enter max amount of marks",
"Marks",
JOptionPane.QUESTION_MESSAGE);
int input1 = Integer.parseInt(input);
return input1;
}
public static int getMarks(int totalMark)
{
int array[] = new int [totalMark];
for (int i = 0; i < totalMark; i++)
{
String input = JOptionPane.showInputDialog(null,
"Enter the marks",
"Marks",
JOptionPane.QUESTION_MESSAGE);
int input1 = Integer.parseInt(input);
array = input1;
}
}
}
"
Does anyone know how to send the array back to main so i can use it in another method?
"
import javax.swing.*;
public class arraymethod11
{
public static void main(String args[])
{
int i = 0;
int totalMark = getMarkLength(i);
}
public static int getMarkLength(int i)
{
String input = JOptionPane.showInputDialog(null,
"Enter max amount of marks",
"Marks",
JOptionPane.QUESTION_MESSAGE);
int input1 = Integer.parseInt(input);
return input1;
}
public static int getMarks(int totalMark)
{
int array[] = new int [totalMark];
for (int i = 0; i < totalMark; i++)
{
String input = JOptionPane.showInputDialog(null,
"Enter the marks",
"Marks",
JOptionPane.QUESTION_MESSAGE);
int input1 = Integer.parseInt(input);
array = input1;
}
}
}
"
Does anyone know how to send the array back to main so i can use it in another method?
Last edited: