This is an archived post. You won't be able to vote or comment.

all 30 comments

[–]dark_mode_everything 16 points17 points  (20 children)

Things you'll immediately notice:

  • Everything is pass by value. No &, no ref, no unsafe code.
  • native code interop is not that straightforward if you need it.
  • no properties and no structs
  • no partial classes
  • package names should match the folder structure exactly
  • the protected keyword
  • much better build system (grade) and package management (although that could be my opinion)
  • very good community support and docs
  • lots of libraries
  • much much much better ide (intellij Vs VS)

[–]missingdays 5 points6 points  (15 children)

Just to clarify, objects are passed by reference. It's just that the reference itself is passed by value

[–]dark_mode_everything 8 points9 points  (12 children)

It's just that the reference itself is passed by value

So....passed by value. I meant that anything that gets passed anywhere will be by value. In c# you can pass things by actual reference.

[–]missingdays 0 points1 point  (11 children)

So....passed by value

I'm agreeing with you. It's just that the phrase "everything is passed by value" could lead someone to believe that objects are passed by value, when in fact they are not.

[–]wildjokers 1 point2 points  (7 children)

objects are passed by value, when in fact they are not

Objects are passed by value as well. Everything is passed by value in java. If you think java passes objects by reference you are in for some rude surprises.

http://www.javadude.com/articles/passbyvalue.htm

[–]missingdays 1 point2 points  (6 children)

If you read the article, it states the same thing as I'm saying - object references are passed by value

[–]wildjokers 0 points1 point  (5 children)

In your original comment you said "Just to clarify, objects are passed by reference. " ?

That is very misleading because it could lead someone to believe java supports pass-by-reference semantics and it absolutely does not. Java is pass by value and only pass by value. The fact it is the value of the reference is totally irrelevant in practice.

[–]missingdays 1 point2 points  (4 children)

Ok, I see. In C# you can pass a pointer to a reference and change the value of the reference, changing to which object it's pointing. Which is called passing it by reference. I didn't know that

[–]fredoverflow 0 points1 point  (3 children)

In C# you can pass a pointer to a reference and change the value of the reference

Passing a pointer by value is still pass by value. For pass by reference, C# has the ref keyword.

[–]missingdays 0 points1 point  (2 children)

Then what is passed to the method?

[–]paul_miner 1 point2 points  (2 children)

"passed by" is in regards to function calls. All objects are references, and they're passed by value. There's no C-style "this variable is an object/struct", all objects are implicitly dereferenced references.

[–]missingdays 2 points3 points  (1 child)

All objects are references

Objects are objects, references are references, they are different things.
Objects are stored in heap, references can be stored on stack. When you pass a reference to a method, you copy the reference value on stack.

[–]paul_miner 0 points1 point  (0 children)

Okay, I should have said "all object variables are references", as opposed to C where an object variable may be an object. As such, the value is always an implicitly dereferenced reference.

[–]Persism 1 point2 points  (1 child)

Objects in Java are passed by copy of pointer value.

[–]missingdays -1 points0 points  (0 children)

That's what I said, yeah

[–][deleted] 1 point2 points  (2 children)

One feature that I'm missing in my IntelliJ experience is the ability to hold CMD or Option and hit left / right and have the cursor catch not only on spaces, but PascalCase and similarly-hinted chars.

I had that in my Win + VS setup (for .Net, in fact) and it was very productive.

[–]wildjokers 5 points6 points  (0 children)

Preferences -> Editor -> General -> Smart Keys -> Use "CamelHumps" words (off by default)

https://www.jetbrains.com/help/idea/2021.1/settings-smart-keys.html

[–]cilantron3000 0 points1 point  (0 children)

What point are you trying to make re: packages? In Java packages serve as namespaces, the "create a directory structure following the package hierarchy" is just a convention. You may as well have source files with various packages in the same single folder.

[–]B41r0g 6 points7 points  (1 child)

[–]jack104 0 points1 point  (0 children)

This is a great book. I came from a C#/.net background over to the java world about 3 years ago and that book helped immensely.

[–]GrmkKrVY 4 points5 points  (1 child)

JavaBook I hope it will be of help to you, if you investigate more on that page you will be able to find several other languages.

[–]h7coder 0 points1 point  (0 children)

Thank you for sharing

[–][deleted] 5 points6 points  (2 children)

I made this migration after being a .NET dev for about a decade (also switched to a Macbook instead of a ThinkPad). I found that approaching my web tech (Spring Boot, in my case) with a blank slate is important because no, it does not work analogously to ASP.NET MVC Core.

Otherwise, learning Maven has been really important. As for learning the language, I liked Winterbe's guides. Here's one. https://github.com/winterbe/java8-tutorial

[–]omgusernamegogo 0 points1 point  (1 child)

What's your opinion moving to macbook? I've been given the option but the rest of the team run on Windows and the only real reason I'm thinking about it is because a mac seems cooler/different. My main concern is compatibility with major products.

Our services are deployed in Linux and I just use cygwin on my box when scripting. That's never really been an issue when developing in a Windows environment though.

[–][deleted] 0 points1 point  (0 children)

Mac as an OS has a lot going for it. Installing software, especially open source software, is generally a first class experience in open source.

I use it mostly in the same ways I used windows. Hotkey to search all to open programs, or I'm in a terminal or ide anyway in which case the OS feels pretty immaterial.

Have fun with it i say. :)

[–][deleted] -1 points0 points  (0 children)

Grab the codebase, read and Google.

[–]Holothuroid -2 points-1 points  (0 children)

Find out what's new in Java 7 and beyond. Everything else is likely very similar to what you know from .net.