我想知道是否有可能更改下面的代码,第二个输出打印更改的变量,我得到"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;
}
}
Run Code Online (Sandbox Code Playgroud)