...

View Full Version : Passing String messages in Java



ragol_67
11-16-2004, 03:21 AM
How can I pass a string message to another method?

turbowrx
11-16-2004, 04:12 AM
By message are you referring to the soap technology or a you just referring to a string?

ragol_67
11-16-2004, 07:07 PM
I want to say something like

String message;

message = "Hello";

Then pass that message to another method so I could use it in another method like so:

System.out.println (message);




Thanks,
Nick!

Roelf
11-16-2004, 07:55 PM
define your method so that is accepts a String as an argument, then you can use it in your message:

public void useTheMessage(String mess){
System.out.println(mess);
}

then you can do:
useTheMessage("Any message you want to sop");

JPM
11-16-2004, 07:57 PM
like this?:


.....
printTest("texttoprint");
....
....
void printTest(String text)
{
System.out.println(text);
}


Edit: Didn't see your post Rolf...

ragol_67
11-16-2004, 11:47 PM
Thank You! :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum