3 ms·
Go compiles to native code and uses less memory than Java does. Go is slower than Java right now (for most things), but is less optimized so there is hope that
by iends 12y ago
Go compiles to native code and uses less memory than Java does.
Go is slower than Java right now (for most things), but is less optimized so there is hope that it catches up and maybe one day is faster.
Both languages have GC.
Go has OOP, but not with classes.
Go does not have generics, see the 50,000 blog posts for details.
Go has less boilerplate than java but still some (mainly it is explicit in checking for errors).
Go has built in HTTP server, and you don't have to deal with containers, application servers, etc.
Go has some pretty incredible tools that come for free (race detector, gofmt, etc) but is lacking in some tools that Java excels with (IDEs & debuggers).
If you're already writing Java, Go isn't a huge win. If you're using Ruby/Python/JS and want more performance Go is a choice instead of the JVM.
- waps 12y agoThe difference that seems to matter to most people is that Go has a standard library that's (currently) free of cruft, and free of "historical reasons". Java's standard library is bytecode-compatible with Java1 programs, which will run fine on today's JVM's. This results in several very dumb and ugly inconveniences. For example, take a look at the ArrayList javadoc. Notice the Object methods (clone(), and toArray()), which are there because the return-type polymorphism doesn't work (you cannot call a different method based on what you assign the function result to). So it's not possible to provide a valid Clone() method that returns something other than Object without breaking java1 programs that use it. (Go's has compiler hacks for core datatypes for some things, which of course means it's a matter of time until things break, but for now ...). Of course if this was the only instance of this sort of problem, nobody would care, but you can find examples like this in most core classes. TLDR: Go is in it's honeymoon period. More detailed explanation : http://stackoverflow.com/questions/17509659/why-standard-java-classess-clone-return-object-instead-of-actual-type http://stackoverflow.com/questions/17509659/why-standard-jav...