A generates B's object and returns B
B adds records
C has an object of B in the argument, creates the file with the added record, and returns the file name
A and B are done, but I don't know how to pass the list created by B to C
public class A {
public B create() {
Bb = new B()
return b;
}
}
B is
public class B{
private ArrayList list = new ArrayList();
publc void add(inta, intb, String c) {
list.add(a);
list.add(b);
list.add(c);
System.out.println(list);
}
}
Let's say
For X,
public classx{
public void test {
Aa = new A();
Bb = a.create();
b.add(000001,1234, "Test Data";
}
}
The expected results have now been printed.
After that, if you can create a method of C and call it X, it will be done
In C,
public class C{
public String createFile (Badd) {
// Create file
}
}
What should I do to give the information of B's add to create this part of C?
java
As it is a stub, I will explain that I don't know how to contour the class, not the real code part of the process of adding records or generating files.
Java classes need to be instantiated, so to use A, B, and C classes, you need to instantiate them as follows:
Aa=newA();
Bb = new B();
Cc = new C();
Also, you must define a method for the class to do something.
Based on these, I think the class definitions of A, B, and C are as follows.
Class A:
public class A
{
/** Generate B object */
public void createB()
{
return new B();
}
}
Class B:
public class B
{
/** Add Record*/
public void addRecord (Object object)
{
}
/** Retrieve records*/
public Object getRecord()
{
}
}
Class C:
public class C
{
public String createFile (Bb)
{
// Get Record Created
Object object = b.getRecord();
// file creation process
・・・
return "filename";
}
}
If you want to use them, you will see the following:
Aa=newA();
// Generating B Objects
Bb = a.createB();
// Adding Records
b.addRecord(/*something that represents record information*/);
// file generation
Cc = new C();
String fileName = c.createFile(b);
The input information is not provided, so the arguments are appropriate.
540 Unable to install versioned in Google Colab
682 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
544 Understanding How to Configure Google API Key
545 PHP ssh2_scp_send fails to send files as intended
546 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.