|
学个计算机和什么什么了一样,整天扣着一些用不着的功能死磕,其它class又不是很少,扣着int double在那肯起来了
哪个脑回路会不断赋值,运用各种编译器技能(数值丢失)在那里写一大串问你最后结果是什么,问题是还tm没有高亮,没有编译运行。
举个例子吧:
学了一天的string.compare
要是谁能用得上这个功能我直接把我固态硬盘吃了。
题大概是这样的:
Consider the following code segment. String str = "CompSci"; System.out.println(str.substring(0, 3)); int num = str.length();
What is the value of num when the code segment is executed?
[backcolor=rgba(145, 39, 37, 0.1)][color=rgb(255 255 255 / var(--tw-text-opacity))][backcolor=rgb(1 92 176 / var(--tw-bg-opacity))]A
3
B
4
C
5
D
6
E
7
[backcolor=rgb(244 244 245 / var(--tw-bg-opacity))]Answer AIncorrect. This would be the value of num if it was assigned the length of str.substring(0, 3), rather than the length of the original string.
想不到吧,人家输出的是Str,问的是num的长度,要不是论坛有审核机制我就直接在这里问候他全家。
Consider the following method. public int timesTwo (int n) { return n * 2; }
The following code segment appears in a method in the same class as the timesTwo method. Integer val = 10; int result1 = timesTwo(val); Integer result2 = result1; System.out.print(result2);
What, if anything, is printed as a result of executing the code segment?
A
10
B
20
[backcolor=rgba(145, 39, 37, 0.1)][color=rgb(255 255 255 / var(--tw-text-opacity))][backcolor=rgb(1 92 176 / var(--tw-bg-opacity))]C
Nothing; the code segment will not compile because timesTwo cannot accept an Integer parameter.
D
Nothing; the code segment will not compile because the value returned by timesTwo cannot be assigned to result1.
E
Nothing; the code segment will not compile because the int variable result1 cannot be assigned to the Integer variable result2.
[backcolor=rgb(244 244 245 / var(--tw-bg-opacity))]Answer CIncorrect. The code segment will compile properly because the Java compiler automatically handles conversions between Integer and int.
想不到吧,这种恶心的事情还用特意说出来?防失业小技巧?
恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我,恶心我。
|
|