livingenzyme
Technical User
How do I pass multiple parameters back and forth between main and subroutine? Say I have the following program.
public class test {
public static void main(String[] args) {
char a=' ';
int b=1;
sub(a,b);
System.out.print(a +" " +b);
}
static void sub(char a,int b) {
a='h';
b=15;
return new Object(a,b);
}
}
Obviously, the ouput isn't going to be "h 15". What do I need to change for a and b to be passed back to main?
PS - I must say I am frustrated by java.
public class test {
public static void main(String[] args) {
char a=' ';
int b=1;
sub(a,b);
System.out.print(a +" " +b);
}
static void sub(char a,int b) {
a='h';
b=15;
return new Object(a,b);
}
}
Obviously, the ouput isn't going to be "h 15". What do I need to change for a and b to be passed back to main?
PS - I must say I am frustrated by java.