1.eg:
static int x = y;
static int y =5;编译错误,变量的提前引用. i know.2.eg:
static int x = returnY();
static int y = 5;
static int returnY(){
return y;
}public static void main(String[] args){ System.out.println(x);
}now x is a number 0 ; // why is 0?? and why not a compile error??3.eg:static int y = 5; // 提上前了.
static int x = returnY();static int returnY(){
return y;
}public static void main(String[] args){ System.out.println(x);
}now x is a number 5;
static int x = y;
static int y =5;编译错误,变量的提前引用. i know.2.eg:
static int x = returnY();
static int y = 5;
static int returnY(){
return y;
}public static void main(String[] args){ System.out.println(x);
}now x is a number 0 ; // why is 0?? and why not a compile error??3.eg:static int y = 5; // 提上前了.
static int x = returnY();static int returnY(){
return y;
}public static void main(String[] args){ System.out.println(x);
}now x is a number 5;
解决方案 »
- 请问关于java连mysql后查询中得到有多少列的函数是?
- 有个问题一直不明白。
- 问一个socket传输文件的问题
- java.nio.SocketChannel读完数据还表示isReadable是什么原因?
- 学java,要学什么,我来告诉你
- 我定义了一种新的语言,想做一个编译器把它转化成 .java文件,但编译学得不好,希望各位朋友给与指点,提供一些实际应用的例子,万分感谢
- 怎样控制JPasswordField不可以输入空格?请大家帮帮我,多谢了
- 求把尺子
- 在服务器本地上applet正常,为何用客户机浏览就报告applete.class找不到??
- jdk1.5 1.6.1.7的区别
- 求救,我不知道怎么错了
- 关于合并EXCEL单元格的算法?
static int returnY(){
return y;
}
但此时y还没有赋值,就返回int型(y是int型)的默认值0.所以输出的是0.