I'm a C# programmer writing Java (for Android) and have a few technicalities of Java I'm still not sure about, and worried I'm approaching from a C# angle:
equals()
or == by default. Basically is object.equals roughly the same as C# (reflection for value types, address reference for reference types)Answering in order:
ref
or out
Object
reference and a primitive value, autoboxing/unboxing gets involved, and I can never remember which way round this works. It's a bad idea though, IMO.)Are parameters in methods passed in the same manner as C#? (Copied for reference types)
All primative types are copied, all objects are actually pointers to objects, the pointer is copied, but the actual object isn't copied.
Why has the @Override attribute suddenly appeared (I think it's Java 1.5+?)
It hasn't, since Java 1.6 you can also use it to show a method is implementing an interface. The @Override allows you to indicate to the compiler that you think you are overriding a method, the compiler will warn you when you aren't (this is very useful actually, especially if the super class changes)
How is possible to compile an application, if you are missing a dependency for one of the libraries you're using?
I don't think it is.
Do I need to worry about using += for large string concatenation (e.g. use a StringBuilder instead)
In some cases. The java compiler + VM is very good at automatically using StringBuilder for you. However it will not always do this. I wouldn't optimize for this (or anything) beforehand.
Does Java have operator overloading: should I use equals() or == by default. Basically is object.equals roughly the same as C# (reflection for value types, address reference for reference types)
No it doesn't have operator overloading.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With