L*****y 发帖数: 4290 | 1 就是这个id太新了, 换个马甲来
I have a Dell ultrasharp u2410, new,unboxed,$300 |
|
j*y 发帖数: 320 | 2 171813976944
unboxed TT black |
|
s**g 发帖数: 15 | 3 Generics(C++ template like) support.
Perl style foreach support.
Autoboxing/Unboxing
Typesafe Enums
New concurreny package
varargs accept variable-length argument lists
Static Import |
|
b******y 发帖数: 9224 | 4 java's int and integer is using auto-boxing/auto-unboxing. Syntactic sugar I
think.
Internally, it is just int or Integer object.
So, int[] != Integer[]
Otherwise, it is too much of a waste in terms of memory usage, should you
use simple int[] array. |
|
r*****l 发帖数: 2859 | 5 This is not a bug. Nothing is in conflict with Java SE or JVM specs.
This is related to auto boxing and unboxing in Java. You are right to say
Java does not have operator overload.
"==" does NOT compare hash values.
You are right to say Java is not c++.
I see that probably you are a very good c++ programmer. |
|
l******y 发帖数: 182 | 6 (一)在generics里,我写一个abstract class A
abstract class A {
...
}
我想写一个B去继承,哪种格式是对的?
1. class B extends A {
...
}
2. class B> {
...
}
3. class B extends A {
...
}
在我的书上例子中,只能找到第2种,比如
class B> {
....
}
(二)java的number class是不是不支持+-*/运算?似乎我直接用e1, e2 extends
Number, 然后做e1 + e2会报错。那个auto-boxing和auto-unboxing是不是只对Integer
, Double这样的类才有用,对Number没用? |
|
z***y 发帖数: 42 | 7
good
duplicate I
Take a look at how Go does struct composition and interface
composition. Actually, even in language like Java and C++, composition
is encouraged over inheritance many times.
As for generics, in Go you can use empty interface to construct data
type and unbox explicitly. It is not as easy to use as generics, but it
is OK most of the time. For people heavily use generics, maybe it is a
pain. But I never find generics is critical for me. |
|