由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 为什么结果是3?
相关主题
java ArrayList 一问 (转载)interview求助
Re: Is java using call by reference?soft reference和weak reference的区别
please help me to solve this question!eclipse 问题
我只能抗议OracleJDBC了!: 请教一个关于JDBC的问题,实在太烦了!java有啥好的reference的网站
what this line of code mean?java 的函数 xxx(a, b,c)能够向a 写入数据吗?
Re: [转载] Questions on failover & Hot depjava知道一个reference怎么删掉它指向的内存空间? (转载)
A very Stupid Question谁能refer个湾区的jr, mid level java SDE?
improve speed已毕业在找工作,看不到希望, 求refer,求信息,感谢!
相关话题的讨论汇总
话题: besttimes话题: double话题: times话题: refer话题: 元素
进入Java版参与讨论
1 (共1页)
w*********n
发帖数: 439
1
double[] times = {3.56, 3.9, 2.6, 4.5, 2.4, 5.2};
double[] bestTimes = new double[4];
Arrays.sort(times);
bestTimes = Arrays.copyOfRange(times, 1, 4);
(Refer to code example 11-1.) What is the length of the bestTimes array?
Answer
a.3
b.6
c.5
d. 4
h**k
发帖数: 662
2
这个难道不是看api嘛
to index is exclusive

【在 w*********n 的大作中提到】
: double[] times = {3.56, 3.9, 2.6, 4.5, 2.4, 5.2};
: double[] bestTimes = new double[4];
: Arrays.sort(times);
: bestTimes = Arrays.copyOfRange(times, 1, 4);
: (Refer to code example 11-1.) What is the length of the bestTimes array?
: Answer
: a.3
: b.6
: c.5
: d. 4

z****e
发帖数: 54598
3
[1,4)
w*********n
发帖数: 439
4
多谢回复。请问我的理解对吗?
1。double[] bestTimes = new double[4];
//说明 bestTime 里面有4个元素是把?
2。Arrays.sort(times);
//把time里面的元素排序对吗?
3。bestTimes = Arrays.copyOfRange(times, 1, 4);
//把bestTimes元素1取到元素4复制给times对吗?
这样从元素1到元素4不是4个元素吗怎么是3呢?

【在 w*********n 的大作中提到】
: double[] times = {3.56, 3.9, 2.6, 4.5, 2.4, 5.2};
: double[] bestTimes = new double[4];
: Arrays.sort(times);
: bestTimes = Arrays.copyOfRange(times, 1, 4);
: (Refer to code example 11-1.) What is the length of the bestTimes array?
: Answer
: a.3
: b.6
: c.5
: d. 4

z****e
发帖数: 54598
5
你找本java教材好好看看吧
从头看到尾,你问的问题java教材上都有
学习语言不是考试,背题没有太多意义
就算给了你答案,换个题目你还是不会做
r********r
发帖数: 208
6
double[] bestTimes = new double[4];
...
bestTimes = Arrays.copyOfRange(times, 1, 4);
The above 2 bestTimes's refer to 2 different arrays, and the memory referred
by the former will be GCed sooner or later.
Correct me if I am wrong.
P**l
发帖数: 3722
7
把程序抄下来。
一步步debug下就明白了
n******t
发帖数: 28
8
这个跟GC 没关系.
想想bestTimes 里存的是什么东西, '='是一个赋值操作.
1 (共1页)
进入Java版参与讨论
相关主题
已毕业在找工作,看不到希望, 求refer,求信息,感谢!what this line of code mean?
求refer,推荐,长短期,free都可以,一个月工资作为感谢Re: [转载] Questions on failover & Hot dep
现在就业市场很光明啊A very Stupid Question
CS不奢望大公司,求小公司refer实习或工作,会答谢一个月工资improve speed
java ArrayList 一问 (转载)interview求助
Re: Is java using call by reference?soft reference和weak reference的区别
please help me to solve this question!eclipse 问题
我只能抗议OracleJDBC了!: 请教一个关于JDBC的问题,实在太烦了!java有啥好的reference的网站
相关话题的讨论汇总
话题: besttimes话题: double话题: times话题: refer话题: 元素