java数据类型问题
public class Bottem2 {
int doX(Long x, Long y) { return 1; }
int doX(long... x) { return 2; }
int doX(Integer x, Integer y) { return 3; }
public static void main(String[] args) {
new Bottem2().go();
}
void go () {
short s = 7;
System.out.print(doX(s,s) + " ");
System.out.println(doX(7,7));
}
}
为什么运行结果是 2 3,long... x代表什么啊 ?请高人指点
不定参数列表 就是输入的long型参数个数是不一定的 和long[] x的意思有点像
不错, 有点 想 数组。。。
那为什么不执行int doX(Long x, Long y) { return 1; }
这句呢?
因为你的可变参数列表是long...啊 注意是小写的
6分理解。。。
这句 int doX(long... x) { return 2; } 不是long类型的么?
你的程序等价于:
Java code:
public class Bottem2
{
int doX(Long x, Long y)
{
return 1;
}
int doX(long[] x) {
return 2;
}
相关问答:
我在jsp页面存上一个session,本页面还可以取出值来.
但是一刷新,或者打开新的页面就取不出值来了.
奇怪的是,我测试另一个程序时候
在jsp页面存上一个session,本页面可以取出值来,刷新或打开新页面值能取出来了.
......
<%@page language="java" contentType="text/html;charset=gb2312" import="java.sql.*"%>
<jsp:useBean id="db" class="wang.connectDB"/>
< ......
我想使用Lucene的代码,发现要import一批文件:
============
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
………………
===== ......
我想用Java写一个程序,就是我想在运行代码后,在指定的时间打开某程序,例如我运行代码后,讲在12:00打开"D:\Program Files\Tencent\QQ2009\Bin\QQ.exe"这个程序,求高人指点。还有可能的话在指定的时间 ......
Java code:
public static void main(String[] args)throws Exception {
String json="{\"installer_id\":\"00000003\",\"installer_name\":\"王五\& ......