Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Learn Java in Minutes (learnxinyminutes.com)
77 points by Ashuu on July 1, 2013 | hide | past | favorite | 51 comments


I'm learning Java in my spare time just because in the same sense it pays to know C if you dig Unix, I suspect it pays to know Java if you dig the JVM.

The language has not proved to be too disturbing, happily, but I'm finding the tooling and ecosystem to be rather arcane and difficult to get a grip on at first. Build tools, a choice of JVMs and JDKs, "enterprise" this or that.. it seems all the stuff around the language is the real minefield than the relatively simplistic language itself.


Exactly. The hard part of Java is not the language per se, but the myriad of IDEs and XML configuration files.


To be honest, as a Java veteran, there is very little XML any more apart from a bit of Tomcat config usually. It's all gone in favor of annotations which are much better.

It ain't J2EE 1.4 days any more (thank fuck).

The only thing I've done involving XML recently was setting tomcat 7 to serve a war file from the root site and that took about 2 minutes to work out.


I haven't used an XML config file in literally years. Either use embedded Jetty directly or use a nice thin wrapper like DropWizard.


Is there any language this is not true of?


I think we are getting into spam territory with this site.


It may be perceived to be spammy with the frequency of front-page posts, but the site is anything but "spam". I find the site quite useful.


I can't seem to understand if people really do think they can learn a language in X minutes. It takes countless hours of writing code in a specific language to learn it, and many months of writing on it to call yourself a good programmer in that language, or expert. </rant>


It's getting tiresome to always see this same comment on every post of this kind. Let's keep the semantics arguments off HN.


I just learned it! and it was damn easy! brb, fixing my resume.


It's more of a "kickstart your Java knowledge" I guess.

Sam can't teach you to become an expert in 24 hours, but you can get a better knowledge if you come from another language / have seen Java before.


I think these articles are a decent cheat sheet beginners can reference when writing their first few programs. Annotated example code is extremely useful.


Of course it would be very short-sighted to assume you could gain expert knowledge of a programming language in X minutes. However, these cheat sheets are a great way to get started in an unfamiliar environment, given that you know your basics.


You can learn to yo-yo in 5 minutes. You can also learn for years. There are different demands for different amounts of mastery. This one is just particularly low. (knowing the general ideas behind java is better than none)


I always just replace it with "Learn enough X to read a codebase in Y Minutes"


It should be obvious to anyone that you won't learn JAVA by simply looking over this.

The point is that for learning it is very important to

1) Get a basic overview of terminology and a general feel for the domain (traditionally you pick up three or so books on the topic, browse through them and note similar/repeatet patterns on a very high level)...then you can break down the learning into subcomponents

2) Find a way to get started and just do it

Creating your own checklists, flash cards, high level presentation on the topic are great starting points and usually step 0 before practice, practice, practice.

This looks like an excellent first step for anyone that wants to start with JAVA.


Like someone else mentioned, they are essentially cheat sheets. Very useful if you already know some other programming language.

I especially like pages that map the features of one programming language to another (that I already know). The recent AlloyUI post was an example comparing it to jQuery and YUI: http://alloyui.com/rosetta-stone/

And also see Rosetta Code http://rosettacode.org/wiki/Rosetta_Code


All these Learn x in y minutes are really good cheat sheets. They are also pretty nice to check out before you start on a longer tutorial.


This looks like a great cheatsheet for those doing into to programming at uni (in java). Quick place to check on syntax without having to open a book, browse through slides or googling and ending up on a page from 1990 about how to make good coffee.


A lot of libraries these days come with a Docco[1] annotated code and examples [2]. This looks very similar, but could make use of Docco.

[1]http://jashkenas.github.io/docco/ [2] http://documentcloud.github.io/underscore/docs/underscore.ht...


Convert integer to string...

  "" + 123;


This makes my eyes bleed.


I'm actually trying to learn java from a C# background. Two questions that immediately jumped out at me:

- Do experienced java programming concatenate a bunch of strings together, or is there a format method? -Is anyone actually using Arraylist over Generics?

Also, is including 'switch' worth the screen real estate?


> Do experienced java programming concatenate a bunch of strings together, or is there a format method?

Yeah, I've seen this a lot. IIRC, String concatenations with the + operator are compiled to use a StringBuffer for efficiency. There is also a static method String.format that works with C-like format strings.

> Is anyone actually using Arraylist over Generics?

I'm not sure exactly what you mean by this. The following is pretty standard Java, if you want a list of Strings.

    List<String> list = new ArrayList<String>();
The following gives you a list of Objects (the base type for all objects in Java):

    List list = new ArrayList();
If you put Strings into this list, then they come out as Objects. You'll have to cast to use them as Strings or the compiler complains.


> Do experienced java programming concatenate a bunch of strings together, or is there a format method?

If you just want to append strings, use StringBuilder(not any different from C#). If you want to format strings, use String.format(analogous to C# string.Format)

> Is anyone actually using Arraylist over Generics?

Umm. ArrayList is itself generic.

    ArrayList<String> names = new ArrayList<String>();


You can use String.format:

String.format("The value: %s", theValue);

http://docs.oracle.com/javase/6/docs/api/java/lang/String.ht..., java.lang.Object...)


  // Import all "sub-packages"
  import java.lang.Math.*;
Nope, you don't import all subpackages with this, you import all the static methods defined in the java.lang.Math class


For static import you would need to do

  import static java.lang.Math.*;
The current version would just import all the classes defined in package java.lang.Math (which does not exist, but java.math does).


looking forward for a Javascript version :) ...it would be serious fun to read, knowing all the horrible language gotchas that will soon byte a beginner that starts coding Js after reading only such a guide.



Great reference. I've been programming Javascript since 2005 (back then it was more copy/pasting Javascript snippets though) and still go back there once in a while (mostly for some stuff like type coercion).


Exists in a fork, just waiting on the pull request: https://github.com/adambrenecki/learnxinyminutes-docs/blob/m...


If you are learning that's a good source. They never said that this would make you become an expert. thumbs up. If you already know the basics just don't read it. But everybody one day was a noob.


The faster you learn something the faster you forget it.


That's why guys who finish bottom of their class remember the most.


Well I'd be willing to bet that for the things they manage to learn and imbibe they would be quite proficient. And no matter how smart you are if you learn something as complex as the Java Syntax within just 5 minutes then you're not going to remember it well enough to apply it for very long.


The class name should really be upper camel case...


I'm surprised that anybody would be interested in learning Java after seeing the poor stewardship Oracle has put into the platform.


And I'm surprised you made this comment. I'm no fan of Oracle, but they've done a lot more for Java then Sun did since version 6 came out in 2006. Actually, I'm interested in why you feel this way, would you care to elaborate?


Well if you want to develop for android, Java is the way to go. Of course you could use Scala or Clojure, but without knowing Java, you probably wouldn't understand many library demos, and documentation.


Peter Norvig said otherwise http://norvig.com/21-days.html


http://norvig.com/jscheme-design.html

"I decided I didn't want to spend more than 20 hours on this exercise of learning Java, learning the IDE I was using, and producing a Lisp interpreter."


And hence the missing variable Y.

It has to be declared, defined, initialized, incremented, kept track of by the person reading the source.


I'm so sick of this link!


Uff, I got spoiled by Python's simplicity last week when I checked its page... Java is way more complex to follow through.


Seems like the author forgot to learn the conventions of the language. The site looks like a good reference though


My thoughts to. Indentation was all wrong.


I feel like this might already exist, but a sheet like this for vi/vim and emacs would be tops.


I would really like to see a "Learn C++ in minutes" post.


.. and then forget it in seconds.


you learn it and forget it.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: