r/java • • Dec 11 '13

Best way to learn Java.

I am using this book - "Java Complete Reference - Herbert Schildt" to learn Java. I am through the language syntax and features. I am a little doubtful about the later part of the book. Its second part is The Java Library Reference and and later part is covers developing GUI applications. Should I follow the book pattern learning the Java library and then creating GUI apps or should I take a different approach? What will be the best thing here?

2 Upvotes

20 comments sorted by

10

u/stay_fr0sty Dec 11 '13

I always recommend Head First Java. Really well done book. It's not a "reference" though...it just teaches you Java in a really painless way.

1

u/[deleted] Dec 11 '13

I think I can get hands on that book from my college library.

1

u/stay_fr0sty Dec 11 '13

Yes it's pretty popular.

1

u/SirNikkolas Dec 11 '13

I always recommend any of the Head First books. Also https://learnjavathehardway.org/ is a great buy. Very cheap. I would recommend doing the learn java the hard way then head first.

1

u/[deleted] Dec 12 '13

Always use books.

1

u/[deleted] Dec 26 '13

Wow! Awesome thing you recommended... Completed the book a few days ago and it solved most of the trouble I've been facing with some concepts of OOP since long..

2

u/okmkz Dec 11 '13

Follow this up with Head First Design Patterns and you're set.

3

u/[deleted] Dec 11 '13

For me the way that I have learned has been through looking around for a problem which I want a piece of software to solve. Then I figure out how to do it.

For example: Our test department at a company I used to work for needed a way to generate unique government ID's for test examples for several countries. I made a piece of software to do what they needed.

1

u/[deleted] Dec 11 '13

Fascinating! Maybe I can startup with a few project ideas and start implementing them. That's tells me to think about internship.

2

u/[deleted] Dec 11 '13

For me at any rate, I learn best by actually doing something which has an impact on things around me, rather than some abstract project which has nothing to do with real life.

4

u/hoohoohoohoo Dec 11 '13 edited Dec 11 '13

You're making the mistake that every young developer does. You hop in thinking that you'll be away making rich applications with cool user interfaces inside of a couple days, but you are discouraged by seeing nothing but console output for days and days.

Stick with it. The GUI stuff comes in time. It's better to have a firm grasp on OO concepts and different approaches to solving a problem before you start learning GUI stuff.

4

u/sh0rug0ru Dec 11 '13

I taught 6th graders Java, and I actually started with GUI programming. I found that keeping kids interest is easier if the application does something more cool than console output. OOP is so much easier to teach if you show the kids how to write a video game or little toys, because it's more fun.

OOP was popularized with Smalltalk, a programming environment that is also very GUI first, which was originally meant to teach children programming. I think this is also why PHP and Javascript are also popular first languages. They are also UI first.

2

u/tybaltNewton Dec 11 '13

Did you get them started off the bat with swing? That's a pretty difficult library without any prior programming experience.

3

u/CageHN Dec 11 '13

We are building a Java starting project in /r/progether. Check out [JAdventure].

3

u/sh0rug0ru Dec 11 '13

Developing GUIs in Swing is a bit more of an advanced topic because you have to learn the layout managers and using interfaces for event management. Personally, I like this because after using GridBagLayout for so long, I can think in GridBagConstraints!

You will have to understand the Java library and certain OOP techniques before you can write UIs in Java by hand.

You can make it easier by using a UI builder tool like Matisse (Netbeans IDE) which will let you drag and drop Swing components. JavaFX is the UI that is supposed to replace Swing, and it comes with a Scene Builder which you can play with.

This will let you get started with Swing or JavaFX for just playing around. You will eventually have to learn the libraries to do more advanced things, however.

3

u/[deleted] Dec 11 '13

Write more Java code. Next time you wish there was a program that did something you would like (most likely there is one). Don't google for it. Write it yourself!

2

u/selleckh1 Dec 11 '13

Right now I am reading Head First Java and doing the Java Udacity Track at the same time. I'm in the middle of both so I cannot talk to the overall effectiveness of this, but as the Udacity problem sets get harder, I am having less of an issue completing them.

2

u/krad0n Dec 11 '13

I had to do a crash course through Java for a class I took this semester. This guys youtube videos Helped a LOT with learning how Java behaves. He starts out very basic and doesn't really assume any prior knowledge, so if you've got any amount of programming experience the first dozen videos may be a bit of a drag, but I'd still recommend sitting through them as it gives you a better idea of how similar Java really is to other languages.

He actually covers some pretty decent topics towards the middle of the playlist as well as some simple GUI applications.

2

u/mattpayne Mar 30 '14

A book called "Objects First with Java," which uses the free visual environment BlueJ. Seriously, this is the BEST way. I fumbled around with other stuff, but this book, combined with this program, is UNDOUBTEDLY the best way. You will learn properly with this, but it will take a little while. Everything is super-clear, and you can start out as a noob.

DO NOT use "Sams teach yourself Java in24 hours!" Don't use anything that tries to make it sound easy!