Please don't post "spam" or "Thank you" posts in this thread since this is meant to be used as a guide for all beginners and I am sure we would like it to be on topic. I hope you understand this.

» Introduction to Java «

To start off, Java is a general purpose programming language liked by application developers and web developers alike. It is the force which drives a large number of enterprise applications out there. Read more about it here. And yes, just for the records, Java is not slow!! [ 1 , 2 , 3 ] ;-)

» Getting started «

All you require to develop Java application is a text editor and a JDK which encompasses a Java compiler, a Java Virtual Machine and a host of tools which ease your development. Some handy links (ignore the specifications for the time being):

» Java 8 Download
» Java 8 online documentation
» Java 8 Language Specification
» Java 8 Virtual Machine Specification

After installing the JDK, you might want to take a look at the common problems beginners face when setting up Java and their solutions.

As a beginner, you should know the commonly used JDK development tools like javac, java, jar, javadoc to name a few. Read about them here.

There are a lot of IDE (Integrated Development Environments) out there which greatly reduce the development time and abstract away all the complexities like compiling classes manually, setting up the classpath etc. Though bear in mind that IDEs are not a substitute to understanding how everything ties out under the hood so once you are comfortable with the language, do ensure that you try out things with a text editor. A few free and commercial IDEs are:
» Eclipse IDE [open source]
» IntelliJ IDEA [commercial and free community version]
» Netbeans IDE [open source]
» JCreator [both free and commercial versions]

» Build Tools «

Though compiling Java programs using the javac tool or an IDE may seem fine enough now, it has its limitations. Compiling, building and deploying an entire application using repetitive commands becomes quite tedious. Build tools to the rescue! It is a good thing to have the knowledge of at least one of the build tools under your belt if you want to work with Java in a professional setting. There are a lot of open source build tools out there, Ant and Maven being well known among them. Which build system to use is a personal / project choice though Ant is a good one for beginners.

As those who don't mind writing their build scripts in a scripting language rather than the verbose XML, Gradle looks promising and has a decent userbase.

» Unit Testing «

It's a good thing to get into the habit of unit testing your code. Test cases have a host of advantages over your normal print statements placed throughout your program. Testing helps you in focus on the way your Java object is actually used / the part it plays in the system, thereby improving class design. And above all, its fun. :-) Get the unit testing framework JUnit here or the more recent TestNG Google for 'junit tutorial' and you will surely find something to get you started.

If there is talk about Unit testing, mocking deserves a mention. In simple terms, Mocking provides a mean to simulate your external dependencies in unit tests. As an example, your payment gateway might need to reference a "service" class which sends across a message to an external entity (for e.g. a bank). To unit test this functionality, it is not feasible to send a message since it would count as a stateful transaction. To get around this, your unit test can "mock" out the service and hence the service call during unit testing.

To know more about mocking, this video might help. Once you are comfortable with the concept, head over to Mockito, a very famous Java mocking library and start mocking!

» Links «

When it comes to Java tutorials, there are plenty of tutorials floating around, most of them wrong in a multitude of ways. I would recommend starting out with the official Oracle tutorial.

» Java tutorials (beginners start here!)
» Don't fear the OOP
» Ohio University Java notes

Some free online books / pdf's:
» Think Java
» Introduction to Programming Using Java, Seventh Edition
» Thinking in Java 3rd edition
» Free java books
» Free java books at Developer's Daily
» Onto Java

In case you need to buy a book, consider the ones enlisted below. They are a gem.
» Head First Java 2nd edition[beginner]
» Java Programming Language [advanced]
» Java in a Nutshell [intermediate]
» Hardcore Java [advanced]
» Java concurrency in practice [advanced]
» Effective Java [advanced]
» Growing Object-Oriented Software Guided by Tests
» Clean Code: A Handbook of Agile Software Craftsmanship

For those more interested in watching videos rather than reading books:» Java programming on Freevideolectures

» Java programming on javavideotutes
» Videos on lernerstv
» CS 61-B video lectures

Generic Tech sites:

» JavaWorld
» OnJava
» IBM Java developerworks
» Learn Java on Reddit

If you are one of those people who are interested in reading blogs, I would recommend Reddit , DZone , JRoller and many others.

» Frequently Asked Questions «

» How can I convert a java program to an executable?
» Differences between Java and C++
» What is hell is 'Generics' all about?
» Extending Java with Type Parameters
» Where can I find a more comprehensive FAQ?
» Does Java support pass-by-value or pass-by-reference semantics ?

Just google for 'java faq' and you surely would stumple upon a gold mine of well written FAQ's.

» Certifications «

After getting a good grasp of the subject, you might want to get a good certification to add a feather to your cap. You can find more about Java certification here. Google for 'scjp notes', 'java mock test' or 'scjp mock' to get started. Getting a certification or not is a choice you have to make.

» Of programming and hackers «

The learning process remains incomplete unless we play around with the language, learn to understand others code and implement some sample projects. For those want to learn Java really fast, Teach yourself programming in ten years would be a good read. Some other inspirational reads are ' How to become a hacker ', Great Hackers and other Paul Graham essays . One of our community members, Black Box , has written a nice post targeted at beginners, which enlists what it takes to learn a language.

That being said, you can find a lot of open source Java projects on Java source . Play with them to your fullest, try to see how things are done in the real world and walk the path of a hacker! ;-)

» Game Development «

The Java Monkey Engine makes 3D game dev possible with advanced features like shaders, cloth simulation, bump mapping, inbuilt sound and user interface support and much much more. You can learn more about it on the JMonkey Home page.

Given that 3D game development can be a bit daunting for entry level game programmers, there's an excellent 2D game engine called libgdx worth looking into.

» Epilogue «

After all this, if you still find yourself struggling with some issue, make sure you read this thread and this essay before creating a new topic in the Java forums.

It has taken a lot of effort to come up with these links so that you don't waste your time searching for some study material / reference text. Appreciation goes out to Stephen , Ezzaral , Peter , Alok and others for their suggestions and corrections. So, just go for it, learn, contribute to this thread and above all, enjoy programming!

Java FTW! :-)

Black Box commented: The java forum was in need of a document like this one, great work. +1
Ezzaral commented: Many thanks. We've needed this for awhile now :) +4
John A commented: Good work, my friend. +12
mvmalderen commented: Great stuff here. +13
Megha SR commented: thankyou for this useful information +1
PythonNewbie2 commented: Good starting Java guide. +2
Anuradha Mandal commented: Good post. +0
DJSAN10 commented: great help for beginners.. thank you +2
Mihujoy commented: Thanks for the nice startup tutorial! ~Mihujoy +0
jackbauer24 commented: Good job! :) +3
stultuske commented: Hail to the King :) +14

Recommended Answers

All 46 Replies

Everyone working with Java should take the time to read the Java coding conventions published by Sun: http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
Coding to the common conventions will ensure a consistency that greatly aids both the coder and others reading that code.

Anyone designing programs that involve more than one or two classes could benefit from familiarizing themselves with design patterns. An excellent introduction to this is Head First Design Patterns. Design patterns may or may not be appropriate for a given application, but learning about them and their usage will teach you to look at your program organization in a more critical manner from perspectives that you may not have considered at the outset.

I would like to recomend the the books Core Java Volume 1 and 2 . A really good set of books that covers the most areas you'll need.

A sample chapter on Data Structures in Java from the book Java concepts for Java 5 and 6. A good and thorough read.

commented: :) +1

the art of java, core java and some books from osborne.com and horstmann.com are always good for me. They are useful.

A document describing the common compile time / runtime errors and ways to resolve them; beginners might find it to be useful.

Could I recommend both Notepad++ and JGRASP as lightweight beginner IDEs? I like them a lot when writing individual java files and I don't feel like waiting for Netbeans to come up. They both have the basics, such as Indentation Guides, but JGRASP is more focused on Java, while Notepad++ is highly configurable (such as add-ons, custom highlighting, and code-completion). Just my two cents to help everyone.

I would like to recomend the the books Core Java Volume 1 and 2 . A really good set of books that covers the most areas you'll need.

+1 to Core Java, Volume 1 and 2 By Horstmann. Really good book. One can actually read Head First Java and then come to this book for perfect understanding of the language

A free book 'Processing XML with Java' contains an in depth explanation about working with Java and XML.

Oh I didn't notice that lol.

JSP does use Java though, so some sort of link should be here too.

I am using BlueJ at university to learn OOP concepts using Java. I find it very good.
I highly reccomend the book. "Objects first with java - practical intro using BlueJ"

Java Reference Guide from Informit

Javadocs by example

In regards to the javadoc examples...

Did you remake some of the old API listings with new and improved ones that consist of examples of function usage? O_O

Even if it isn't you... it really must've taken said individual(s) quite some time @_@

> Did you remake some of the old API listings with new and improved ones that consist of
> examples of function usage? O_O

No, I didn't. It's one of those sites which mirror the Java docs along with samples wherever possible. And yes, setting up something of this sort definitely takes up a lot of effort so we should be thankful to those who did this when referring to their API usage / examples. :-)

A site we work with in class is javabat.com .... free, and good practice :)

Following is another site which gives you javadocs with examples.

http://www.kickjava.com

>>Performance<<
Programming in Java over the years, I have encountered quite a few myths (ex. making your variables and methods final), although the following article by Brian Goetz is nearly three years old, I still encounter these "myths" about Java quite a few times mostly from newbie programmers and sometimes even experienced developers.
http://www-128.ibm.com/developerworks/java/library/j-jtp09275.html?ca=dgr-jw22JavaUrbanLegends

Then theres the question of performance of Java both speed and memory management.
The following article again from Brian Goetz should put to rest anyone's doubts in the performance of Java in those sections:-
http://www-128.ibm.com/developerworks/java/library/j-jtp09275.html?ca=dgr-jw22JavaUrbanLegends

Come to think of it, all the articles of IBM Developerworks and JavaWorld are worth the read for every Java programmer out there.

Though it is not Java specific and not targeted for beginners, Code Complete 2nd Edition is an excellent book for anyone engaged in non-trivial programming or interested in software best practices. It's filled with a ton of information and suggestions gleaned from years of professional development experience - all that stuff that most of us working developers have learned the hard way in bits and pieces and wish we'd known from the outset.

commented: Indeed; like they say, "If I have seen further it is only by standing on the shoulders of Giants" +25
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.