I am a beginner. I need to know how we can use the output of one java program in another java program.
both the programs are in the same package.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
I am a beginner. I need to know how we can use the output of one java program in another java program.
both the programs are in the same package.
Do you mean by running it as an external process? See Runtime.exec and
When Runtime.exec() won't - JavaWorld
If you just want to use its classes, add the jar to the classpath
thanks for the reply. Hope I am not bothering u. I'll show u a part of my code. plz help me out.
Package aaa;
It has two java classes.
1) class a(a.java)
2) class b(b.java)
The output of class a is a String s;
I want to use this String s in class b.java
Can u help me write the code.?
Thanks in advance.
One thing you could do is to make the constructor of class b accept class a. That way all you have to do is to ask class a for the string when you want it (basically just call a method that returns the string). Hope I have understood your post right, lol.
lemme check and get back to u.. thanks for the reply..