【发布时间】:2014-12-01 15:21:08
【问题描述】:
我想知道是否可以更改下面的代码,使第二个输出打印我得到“2.2noo100onn”而不是“1.1foo200oof”的更改变量?
是否可以从不同类型返回多种类型,或者有什么方法可以创建一个混合变量类型数组?
我正在处理的代码要大得多,但这个示例的工作方式相同。
public class test
{
static String s1 = "foo";
static String s2 = "oof";
static double d1 = 1.1;
static int i1 = 200;
public static void main (String[] args)
{
// Ausgabe Hello World!
System.out.println(d1+s1+i1+s2);
bla();
System.out.println(d1+s1+i1+s2);
}
public static void bla() {
String s1 = "noo";
String s2 = "onn";
double d1 = 2.2;
int i1 = 100;
}
}
【问题讨论】: