Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Lewis Evans   on May 05 In Java Category.

  
Question Answered By: Guadalupe Rogers   on May 05

public Main{ public static void
main(String[] args){ String[] data =
{"value1","value2"}; Table t = new
Table(); t.setData(data); t.printData(); }}pu\
blic class  Table{ public void
setData(String[] data){ this.data =
data; } public void printData(){ for(int i = 0; i <
data.length; i++){ System.out.println("Data " + i +
"=" + data[i]); } } private
String[] data;}That is probably as
simple of an example that I can give. It is not an
applet, but rather an application, although in the big
picture that shouldn't matter. Notice that I create an
instance of my Table class and then call the methods on
that instance.If you continue to have problems
then you are going to have to produce some code for
us. If you want to send directly to me then I will
look at it: me@...Please note that
I did not compile the code above and there may be
typos, but it should give you a starting
point.

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on passing variables Or get search suggestion and latest updates.


Tagged: