0
長話短說,我想要一種方法來返回兩個項目。我想我已經學會了用嵌入式類來做這件事的最好方法。儘管我在結構和語法方面遇到困難,但如何訪問信息。需要幫助訪問嵌入類中的信息
真的,我想要做的是有一個方法返回一個數組字符串[]和一個字符串。如果你能想到一個更簡單的方法來做到這一點,我會非常有興趣聽到它。
非常感謝你對你幫助
感謝
import java.util.*;
public class test
{
public test()
{
}
public class SQLarguments //embedded class
{
String[] columns;
String table;
public SQLarguments(String table, String... columns)
{
this.table = table;
this.columns = columns;
}
}
public SQLarguments arguments(String table, String... columns)
{
SQLarguments testArgs = new SQLarguments(table,columns);
return testArgs;
}
public static void main(String[] args)
{
test t1 = new test();
t1.arguments("table","col 1","col 2", "col 3");
System.out.println(.arguments[0]);
System.out.println("test");
}//end main
}//end class
這正是我試圖做。非常感謝你真棒! – demuro1