gpt4 book ai didi

java - 包含字符串数组的字符串数组

转载 作者:行者123 更新时间:2023-12-02 03:43:51 26 4
gpt4 key购买 nike

您好,很抱歉问了这个新手问题。我对我的问题进行了大量搜索,但没有发现任何与我的问题相关的内容。

所以我有这样的东西:

public static String something [][] = 
{
{"1","100"},
{"2","1000"},
{"3","10000"}
};

public static String somethingelse [][] =
{
{"1","100"},
{"2","1000"},
{"3","10000"}
};

public static String CATEGORIES[][][] =
{
something,
somethingelse
};

如果可能的话,我当然可以从 CATEGORIES[something].get(1st line) 行返回吗?

我不想使用某些东西[0]我想使用这样的东西 CATEGORIES.something[0]我不知道还能如何解释。

提前致谢!

最佳答案

你可以这样做(但这是一种糟糕的做法):

public static class Categories {
public String something [][] = {
{"1","100"},
{"2","1000"},
{"3","10000"}
};

public String somethingelse [][] = {
{"1","100"},
{"2","1000"},
{"3","10000"}
};
}

public static final Categories CATEGORIES = new Categories();

关于java - 包含字符串数组的字符串数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36521181/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com