Head First Java, 2nd Edition

Kathy Sierra, Bert Bates

Mentioned 37

An interactive guide to the fundamentals of the Java programming language utilizes icons, cartoons, and numerous other visual aids to introduce the features and functions of Java and to teach the principles of designing and writing Java programs.

More on Amazon.com

Mentioned in questions and answers.

It wasn't that long ago that I was a beginning coder, trying to find good books/tutorials on languages I wanted to learn. Even still, there are times I need to pick up a language relatively quickly for a new project I am working on. The point of this post is to document some of the best tutorials and books for these languages. I will start the list with the best I can find, but hope you guys out there can help with better suggestions/new languages. Here is what I found:

Since this is now wiki editable, I am giving control up to the community. If you have a suggestion, please put it in this section. I decided to also add a section for general be a better programmer books and online references as well. Once again, all recommendations are welcome.

General Programming

Online Tutorials
Foundations of Programming By Karl Seguin - From Codebetter, its C# based but the ideas ring true across the board, can't believe no-one's posted this yet actually.
How to Write Unmaintainable Code - An anti manual that teaches you how to write code in the most unmaintable way possible. It would be funny if a lot of these suggestions didn't ring so true.
The Programming Section of Wiki Books - suggested by Jim Robert as having a large amount of books/tutorials on multiple languages in various stages of completion
Just the Basics To get a feel for a language.

Books
Code Complete - This book goes without saying, it is truely brilliant in too many ways to mention.
The Pragmatic Programmer - The next best thing to working with a master coder, teaching you everything they know.
Mastering Regular Expressions - Regular Expressions are an essential tool in every programmer's toolbox. This book, recommended by Patrick Lozzi is a great way to learn what they are capable of.
Algorithms in C, C++, and Java - A great way to learn all the classic algorithms if you find Knuth's books a bit too in depth.

C

Online Tutorials
This tutorial seems to pretty consise and thourough, looked over the material and seems to be pretty good. Not sure how friendly it would be to new programmers though.
Books
K&R C - a classic for sure. It might be argued that all programmers should read it.
C Primer Plus - Suggested by Imran as being the ultimate C book for beginning programmers.
C: A Reference Manual - A great reference recommended by Patrick Lozzi.

C++

Online Tutorials
The tutorial on cplusplus.com seems to be the most complete. I found another tutorial here but it doesn't include topics like polymorphism, which I believe is essential. If you are coming from C, this tutorial might be the best for you.

Another useful tutorial, C++ Annotation. In Ubuntu family you can get the ebook on multiple format(pdf, txt, Postscript, and LaTex) by installing c++-annotation package from Synaptic(installed package can be found in /usr/share/doc/c++-annotation/.

Books
The C++ Programming Language - crucial for any C++ programmer.
C++ Primer Plus - Orginally added as a typo, but the amazon reviews are so good, I am going to keep it here until someone says it is a dud.
Effective C++ - Ways to improve your C++ programs.
More Effective C++ - Continuation of Effective C++.
Effective STL - Ways to improve your use of the STL.
Thinking in C++ - Great book, both volumes. Written by Bruce Eckel and Chuck Ellison.
Programming: Principles and Practice Using C++ - Stroustrup's introduction to C++.
Accelerated C++ - Andy Koenig and Barbara Moo - An excellent introduction to C++ that doesn't treat C++ as "C with extra bits bolted on", in fact you dive straight in and start using STL early on.

Forth

Books
FORTH, a text and reference. Mahlon G. Kelly and Nicholas Spies. ISBN 0-13-326349-5 / ISBN 0-13-326331-2. 1986 Prentice-Hall. Leo Brodie's books are good but this book is even better. For instance it covers defining words and the interpreter in depth.

Java

Online Tutorials
Sun's Java Tutorials - An official tutorial that seems thourough, but I am not a java expert. You guys know of any better ones?
Books
Head First Java - Recommended as a great introductory text by Patrick Lozzi.
Effective Java - Recommended by pek as a great intermediate text.
Core Java Volume 1 and Core Java Volume 2 - Suggested by FreeMemory as some of the best java references available.
Java Concurrency in Practice - Recommended by MDC as great resource for concurrent programming in Java.

The Java Programing Language

Python

Online Tutorials
Python.org - The online documentation for this language is pretty good. If you know of any better let me know.
Dive Into Python - Suggested by Nickola. Seems to be a python book online.

Perl

Online Tutorials
perldoc perl - This is how I personally got started with the language, and I don't think you will be able to beat it.
Books
Learning Perl - a great way to introduce yourself to the language.
Programming Perl - greatly referred to as the Perl Bible. Essential reference for any serious perl programmer.
Perl Cookbook - A great book that has solutions to many common problems.
Modern Perl Programming - newly released, contains the latest wisdom on modern techniques and tools, including Moose and DBIx::Class.

Ruby

Online Tutorials
Adam Mika suggested Why's (Poignant) Guide to Ruby but after taking a look at it, I don't know if it is for everyone. Found this site which seems to offer several tutorials for Ruby on Rails.
Books
Programming Ruby - suggested as a great reference for all things ruby.

Visual Basic

Online Tutorials
Found this site which seems to devote itself to visual basic tutorials. Not sure how good they are though.

PHP

Online Tutorials
The main PHP site - A simple tutorial that allows user comments for each page, which I really like. PHPFreaks Tutorials - Various tutorials of different difficulty lengths.
Quakenet/PHP tutorials - PHP tutorial that will guide you from ground up.

JavaScript

Online Tutorials
Found a decent tutorial here geared toward non-programmers. Found another more advanced one here. Nickolay suggested A reintroduction to javascript as a good read here.

Books
Head first JavaScript
JavaScript: The Good Parts (with a Google Tech Talk video by the author)

C#

Online Tutorials
C# Station Tutorial - Seems to be a decent tutorial that I dug up, but I am not a C# guy.
C# Language Specification - Suggested by tamberg. Not really a tutorial, but a great reference on all the elements of C#
Books
C# to the point - suggested by tamberg as a short text that explains the language in amazing depth

ocaml

Books
nlucaroni suggested the following:
OCaml for Scientists Introduction to ocaml
Using Understand and unraveling ocaml: practice to theory and vice versa
Developing Applications using Ocaml - O'Reilly
The Objective Caml System - Official Manua

Haskell

Online Tutorials
nlucaroni suggested the following:
Explore functional programming with Haskell
Books
Real World Haskell
Total Functional Programming

LISP/Scheme

Books
wfarr suggested the following:
The Little Schemer - Introduction to Scheme and functional programming in general
The Seasoned Schemer - Followup to Little Schemer.
Structure and Interpretation of Computer Programs - The definitive book on Lisp (also available online).
Practical Common Lisp - A good introduction to Lisp with several examples of practical use.
On Lisp - Advanced Topics in Lisp
How to Design Programs - An Introduction to Computing and Programming
Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp - an approach to high quality Lisp programming

What about you guys? Am I totally off on some of there? Did I leave out your favorite language? I will take the best comments and modify the question with the suggestions.

Java: SCJP for Java 6. I still use it as a reference.

Haskell:

O'Reilly Book:

  1. Real World Haskell, a great tutorial-oriented book on Haskell, available online and in print.

My favorite general, less academic online tutorials:

  1. The Haskell wikibook which contains all of the excellent Yet Another Haskell Tutorial. (This tutorial helps with specifics of setting up a Haskell distro and running example programs, for example.)
  2. Learn you a Haskell for Great Good, in the spirit of Why's Poignant Guide to Ruby but more to the point.
  3. Write yourself a Scheme in 48 hours. Get your hands dirty learning Haskell with a real project.

Books on Functional Programming with Haskell:

  1. Lambda calculus, combinators, more theoretical, but in a very down to earth manner: Davie's Introduction to Functional Programming Systems Using Haskell
  2. Laziness and program correctness, thinking functionally: Bird's Introduction to Functional Programming Using Haskell

Some books on Java I'd recommend:

For Beginners: Head First Java is an excellent introduction to the language. And I must also mention Head First Design Patterns which is a great resource for learners to grasp what can be quite challenging concepts. The easy-going fun style of these books are ideal for ppl new to programming.

A really thorough, comprehensive book on Java SE is Bruce Eckel's Thinking In Java v4. (At just under 1500 pages it's good for weight-training as well!) For those of us not on fat bank-bonuses there are older versions available for free download.

Of course, as many ppl have already mentioned, Josh Bloch's Effective Java v2 is an essential part of any Java developer's library.

Let's not forget Head First Java, which could be considered the essential first step in this language or maybe the step after the online tutorials by Sun. It's great for the purpose of grasping the language concisely, while adding a bit of fun, serving as a stepping stone for the more in-depth books already mentioned.

Sedgewick offers great series on Algorithms which are a must-have if you find Knuth's books to be too in-depth. Knuth aside, Sedgewick brings a solid approach to the field and he offers his books in C, C++ and Java. The C++ books could be used backwardly on C since he doesn't make a very large distinction between the two languages in his presentation.

Whenever I'm working on C, C:A Reference Manual, by Harbison and Steele, goes with me everywhere. It's concise and efficient while being extremely thorough making it priceless(to me anyways).

Languages aside, and if this thread is to become a go-to for references in which I think it's heading that way due to the number of solid contributions, please include Mastering Regular Expressions, for reasons I think most of us are aware of... some would also say that regex can be considered a language in its own right. Further, its usefulness in a wide array of languages makes it invaluable.

C: “Programming in C”, Stephen G. Kochan, Developer's Library.

Organized, clear, elaborate, beautiful.

C++

The first one is good for beginners and the second one requires more advanced level in C++.

I know this is a cross post from here... but, I think one of the best Java books is Java Concurrency in Practice by Brian Goetz. A rather advanced book - but, it will wear well on your concurrent code and Java development in general.

C#

C# to the Point by Hanspeter Mössenböck. On a mere 200 pages he explains C# in astonishing depth, focusing on underlying concepts and concise examples rather than hand waving and Visual Studio screenshots.

For additional information on specific language features, check the C# language specification ECMA-334.

Framework Design Guidelines, a book by Krzysztof Cwalina and Brad Abrams from Microsoft, provides further insight into the main design decisions behind the .NET library.

For Lisp and Scheme (hell, functional programming in general), there are few things that provide a more solid foundation than The Little Schemer and The Seasoned Schemer. Both provide a very simple and intuitive introduction to both Scheme and functional programming that proves far simpler for new students or hobbyists than any of the typical volumes that rub off like a nonfiction rendition of War & Peace.

Once they've moved beyond the Schemer series, SICP and On Lisp are both fantastic choices.

For C++ I am a big fan of C++ Common Knowledge: Essential Intermediate Programming, I like that it is organized into small sections (usually less than 5 pages per topic) So it is easy for me to grab it and read up on concepts that I need to review.

It is a must read for me the night before and on the plane to a job interview.

C Primer Plus, 5th Edition - The C book to get if you're learning C without any prior programming experience. It's a personal favorite of mine as I learned to program from this book. It has all the qualities a beginner friendly book should have:

  • Doesn't assume any prior exposure to programming
  • Enjoyable to read (without becoming annoying like For Dummies /
  • Doesn't oversimplify

For Javascript:

For PHP:

For OO design & programming, patterns:

For Refactoring:

For SQL/MySQL:

  • C - The C Programming Language - Obviously I had to reference K&R, one of the best programming books out there full stop.
  • C++ - Accelerated C++ - This clear, well written introduction to C++ goes straight to using the STL and gives nice, clear, practical examples. Lives up to its name.
  • C# - Pro C# 2008 and the .NET 3.5 Platform - Bit of a mouthful but wonderfully written and huge depth.
  • F# - Expert F# - Designed to take experienced programmers from zero to expert in F#. Very well written, one of the author's invented F# so you can't go far wrong!
  • Scheme - The Little Schemer - Really unique approach to teaching a programming language done really well.
  • Ruby - Programming Ruby - Affectionately known as the 'pick axe' book, this is THE defacto introduction to Ruby. Very well written, clear and detailed.

In Java, flush() method is used in streams. But I don't understand what are all the purpose of using this method?

fin.flush();

tell me some suggestions.

If the buffer is full, all strings that is buffered on it, they will be saved onto the disk. Buffers is used for avoiding from Big Deals! and overhead.

In BufferedWriter class that is placed in java libs, there is a one line like:

private static int defaultCharBufferSize = 8192;

If you do want to send data before the buffer is full, you do have control. Just Flush It. Calls to writer.flush() say, "send whatever's in the buffer, now!

reference book: https://www.amazon.com/Head-First-Java-Kathy-Sierra/dp/0596009208

pages:453

I have absolutely no programming experience but need to learn Java - enough to take a J2ME fasttrack course. I only have 10 weeks. Can I do this? What's your advice about the best resources I can use ?(currently using Sun's Java Tutorials).

10 weeks? Apparently you can do it in 24 hours!

http://www.amazon.com/Sams-Teach-Yourself-Programming-Hours/dp/0672328445

EDIT:

Okay, so only 1 person found my answer amusing, but not amusing enough to upvote. The real question is how good do you need to be in 10 weeks?

If you get yourself a good book (the one linked above has some good reviews on Amazon), then in 10 weeks you might be proficient enough to do something useful in Java, but it takes years to become expert. Any time spent between 10 weeks and several years will move you from beginner towards expert.

Oh and read Teach Yourself Programming in Ten Years.

Learning to program for the first time is kind of like learning a foreign language. You will easily be able to recreate the phrases you are taught, but you will lack the understanding of the context for why it is done that way, and will thus be unable to solve new problems effectively. It simply takes time.

If you're a first-time programmer, I really can't recommend Java. Python would be much better (disclaimer: Python fan-boy, but for good reasons).

However, I don't think a beginner could do much better than Head First Java

It depends on how hard you want to work, but yes it's possible. The problem you are going to have is that you have to learn to program along with learning java. These are two very different things. Programming is knowing how to read and write logic and Java is a language you write it in. If you have a math or physics background, this is going to be a lot easier, as you are already exposed to thinking in such a manner.

If you don't have books on beginning Java I would go buy one of those.

I would also pick up the book Code (I would try and get through this in a few days, if not over the weekend if possible). Actually with 10 weeks I would do this first as it will be a foundation for what you'll need to know to program Java.

With 10 weeks, you are going to have to pretty much study every night to get the hang of it by the time you go to class. My best advice is that when you take the class, take lots of notes, and don't expect to understand everything. Most of what gets thrown at you there will probably go over your head at first and you'll forget. That's ok. After the class if over, go back and review the notes etc until it starts to make sense.

I'm computer science student who just finished my first Java course.. I'd say it's possible to learn Java on 10 weeks if you hard work on it. But you'll only get an intro! Programming is much more than just knowing the language (API, syntax etc)..

Best Java book ever: http://www.amazon.com/Introduction-Java-Programming-Comprehensive-Version/dp/0136012671/ref=sr_1_1?ie=UTF8&s=books&qid=1242328533&sr=8-1

I can sympathise... having once been in a similar predicament, though I did at least have some background. I concur with @ShawnMilo regarding Head Fist Java. Also recommend Sams Teach Yourself Java in 21 Days and, given that you say you have no programming background, I strongly urge you to look at The Oject Oriented Thought Process by Matt Weisfeld. I also concur with all the people on this thread who say that there's WAY more to programming than 'simply' learning one language (especially if it's Java). Having said that, good luck and god speed.

PS I'd +1 @Patrick McDonald for sense of humour, but I don't have enough rep!

PPS And another virtual +1 for @Robin. I was wondering when the Four Yorkshiremen would get in on this thread...

I am trying to learn how to specify class constructors in Java. I am starting to understand that they specify the types of instance variables of objects made from that class. They also can be used to set the instance variable initial values. The follow example is from the Java tutorial on Sun's website:

public Bicycle(int startCadence, int startSpeed, int startGear) {
    gear = startGear;
    cadence = startCadence;
    speed = startSpeed;
}

Where in your classes source code should you put the constructor(s)?

Are these arguments the names of the variables?: (int startCadence, int startSpeed, int startGear) or are gear, cadence and speed the names of the variables?

What is the difference between (int startCadence, int startSpeed, int startGear) and gear, cadence and speed?

In the unlikely event that my instructor or any administrator from Salt Lake Community College ever comes across this question, let me make my intentions clear. This question is posted in the greatest spirit of academic honesty. I ask this question to seek general advice and help in understanding the proper way to use the Java programming language. I in no way use the work of others and represent it as my own work. I use the answers provided here as a general aid in my understanding. I do all my own work and do not copy work provided by people answering my question.

You really need a copy of Head First Java

Ok I know this might sound a bit silly, as it depends on the person, but on average how much time should I spend on preparing for SCJP? I already have some experience with Java (a few small and medium projects for my university, from implementing a simple "ships" game to some client-server stuff).

I was thinking about taking it around jun-july '10 so I'd have around 7-8months, is it enough/too much/not enough?

Also I've been looking for a good book, is there anything better than: "Sun Certified Programmer for Java 6 Study Guide" by Kathy Sierra and Bert Bates? And what about some practical questions (like "implement this and this" or "write a piece of code which does...")?

Ah and is it really worth it (I'd spend my own money). I'm not asking if it will make me a better programmer (as I've seen such a thread on stackoverflow alread) but do the employers even care about it?

I've never known being certified to help greatly but I don't live in the US or a hot bed of the IT industry. Someone else may be able to shed more light on this topic, but I can only assume that in a more vibing city for IT such as Silicon Valley or perhaps NY, it may look a little more impressive if two or more candidates are evenly matched. But if you're weak in interviewing skills or thinking on the spot etc, being certified might not help too greatly.

The book you mentioned sounds good and will probably be sufficient. I've always enjoyed the head first series too and in your case perhaps the Head First Java might be worth a look (also Kathy Sierra and Bert Bates).

Some other posts relating to SCJP may be of help too:

Does scjp help

is an scjp certificate worthwhile

It took me 3 weeks to prepare for the Java 6 exam, I have 0 professional Java programming experience. For someone who uses the language daily (like a java programmer) it should be even easier. I was very excited to get it over with as soon as possible, so I ordered the Kathy Sierra SCJP Sun Certified Programmer for Java 6 Study Guide at http://www.amazon.com/SCJP-Certified-Programmer-Java-310-065/dp/0071591060 and one day shipped it to me so that I received it on a Saturday. As soon as it came, I started reading. That took about two weeks as the book is an 800 page monster with some self tests in the book that both give you good practice and teach you some specific details that the book did not mention in the actual chapter (a lot you can guess but not all...). For the last week I reviewed all the 2 Minute Drills and re-read the chapters that were API heavy. Also there are a lot of tables (important string methods, thread methods, file API methods, and concurrency). I also took the two master exams included in the book. I took them in study mode and attempted the question, then if it said wrong, I went and tried to figure out why it is wrong, then I went to the reference/hints if I needed. On the day of the exam I reviewed the File/String/Collections API an hour prior to the exam and took it.

I scored 90% so that's GREAT considering I do not have any Java work experience at all and prepared in 3 weeks. It should be much easier for any professional Java developer to prep/take. Although I have known of Java since it came out, and I used it for the occasional graduate and undergraduate program in college so I'm not totally new. Also, I know other C languages so I am used to much of the control structures, etc... However if I can figure out the API/language workings in three weeks enough to get a 90% any experienced java programmer should have no problem figuring out enough to pass. Still that book is giant, the 2 hours of daily train riding to work was a big help in getting the reading done.

Some people say you have to write a hundred small programs to figure things out. But that book is pretty good on details. The most important thing to write programs about (maybe I wrote 10) are the constructors/initializer blocks/static initializer blocks/to find out exactly what is inherited and to cement the order. And when casting a sub class as its parent, it is important to see what happens when you access the variables/overloaded methods. While the overloaded methods are simple and what is expected, accessing variables is not so straight forward. Trust me, write a few programs about it, especially where the super type/sub type have instance variables with the same name.

I think the main thing I got out of SCJP is a broad overview of the language. Java is a beast, the API/language is huge. Typically I just used the parts of the language I needed for each project/activity in Java and looked up the API as I went. Some key words (like transient) I just did not know. Also some interview trivia (like if you override equals what else must you override) I did not know (at least according to what a friend told me). Also I had no idea about things like the internationalization classes Locale, Calendar, DateFormat, NumberFormat, and Date. Really if I was writing serious Java software, I would probably use Calendar for date arithmetic needs. I don't think it will help me land a Java job as everyone seems to want Java experience prior to even giving you an interview. But if I ever do get an interview, the knowledge I gained from preparing the exam would definitely help me to better answer the questions (though I'm sure a lot of the specific API details will fade with time). Also now I feel more confident with Java. Still I can't say that I can just whip up a Java program on the white board that fully works because the API is very complex. A language like C is pretty small, include stdio.h/stdlib.h/string.h and memorize 30 functions and you can do a lot. Java has way more packages/classes to include and way more API. Also with expressions there are a ton of rules, promotions, casting, autoboxing, etc. which would be really easy to mess up. Though C has precedence hell, with the right parenthesis you can get away with a lot. Java is more strict on things (ie if(0) is an error). But the exam is worth it just for some additional trivia, although the exam is a bit frustrating, and if you look at the book it pretty much tells you that the exam deliberately picks tricky questions and edge cases in an attempt to confuse you. It will deliberately give bad indentation and other stuff to try to be tricky. I hate that because rather than focusing on you knowing the material reasonably, it focuses on trying to confuse you.

One thing of note, don't get thrown by the Master exam. I tried to take one in exam mode, and they gave 75 questions in 1.5 hours and I nearly decided to postpone the exam. The real exam is 60 questions and you get 3 hours. Also the questions on the actual exam are MUCH easier than on the master exam. My master exam score was 37%.... My last two times I just did it in study guide mode, attempted each question/if answer was wrong tired again/viewed reference once with the A exam and once with the B exam... I did fine on the exam and I am really really happy that I did not postpone it over the study guide, because now it is over and I can relax....

I just started to learn Android development.

My previous experience is majorly .NET framework in C#. I have some experience with Linux and basically no idea about Java.

So, which is the good way to be an Android development expert? Books? Study roadmap? Anything would be appreciated. I am all ears to your advises.

Thanks.

(Apologies if this is not the right place to post such a question.)

The first thing you must do is learn Java. Head First Java would be a nice introduction. Android applications commonly use complex Java concepts, such as inner classes, anonymous classes, generics, etc. You should become a Java expert before becoming an Android expert. It will make your life alot easier.

After this I would recommend learning Android by reading an intro book such as Beginning Android 2.

After this -- or as a supplement to the book -- go check out the android developer's guide, where you will get tons of great tips and sample code. Make sure you understand all of this sample code.

Somewhere along the way, you should check out this wonderful tutorial on creating a "real-life" application. It goes step-by-step and helped me alot.

In order to cover for my (glaring) lack of knowledge in the basics of networking, I'm looking for a book which would ideally cover:

-> 1 or 2 chapters on the transport layer: tcp, udp...

-> 1 or 2 chapters on the application layer: http, dns...

-> rest of the book would be devoted to pratical way of sending data across the wire using Java-related technologies. This would involve discussions about existing products (eg. hessian, protobuf, thrift, tibco...) , performances comparisons, case studies...etc..

Does such a book exist ?

Edit: Thanks for all the answers so far... however most of the books listed focus heavily on the lower levels of the networking stack (ie. tcp/ip, network administration...). This is one-half of the answer only. I'm still eager to hear suggestions about the other half: discussions around the "state of the art" options available to the Java developer to ferry data around, what products/frameworks are available and how do they compare.

For a TCP/IP text (Not Java centric)

For a Java Networking book I would go with this. Most books are very dated and do not cover the newer stuff, this one covers NIO as well as uses generics in the examples.

If you are looking for improving upon basics on networking it would be better if you look at books which cover basics of networking. Once you are comfortable with the basics of networking you can start with the networking section in Java tutorial and explore the appropriate Java libraries. Networking is an area of its own whose understanding is independent of any programming language.

That said, some of the networking books which I have found helpful are :

Internetworking with TCP/IP, Vol 1 by Douglas Comer

TCP/IP Illustrated Vol.1 by W.Richard Stevens

Computer Networks by Andrew.S.Tanenbaum

As a primer on networking in general, I'd recommend TCP/IP Network Administration, Third Edition, by Craig Hunt. This book provides a chapter on the TCP/IP stack, another on Addressing and routing and the remainder of the book covers in reasonable depth most common network services and diagnostic tools.

For a heavyweight reference, get TCP/IP Illustrated, Vol 1: The Protocols, by Richard Stephens, if you become obsessed with networks buy or borrow volumes 2 and 3.

As far as Java specific networking introduction, I'd suggest Java Network Programming, Third Edition, by Elliotte Rusty Harold, this book does take some critiscim but I still believe it's a good introduction and is an approachable read.

It's a general book for Java beginners but the part about networking is very, VERY clear and easy to grasp.

Head First Java, 2nd Edition

I am a beginner at java and i am learning java by thenewboston's java for beginners series. http://www.youtube.com/playlist?list=PLFE2CE09D83EE3E28&feature=plcp

it is very interesting and easy to understand but as i can see that he only explains the main part and doesn't share a lot of information due to the simple fact that java is such a wide language.

but, i need some sources to learn java in a little more depth. I have listened a lot about head first java but is it good enough? is it worth buying? will it be too difficult for me to understand?(i have already learnt the basics of python so i have a grasp on programming language and i am not facing difficulties to understand those videos either.)

what i want to do is that, first understand the basics by thenewboston's videos on youtube and then study it in detail. also, what is the difference between head first java and headfirst java 2nd edition?

http://www.amazon.com/Head-First-Java-Kathy-Sierra/dp/0596009208/ref=sr_1_1?s=books&ie=UTF8&qid=1343374211&sr=1-1&keywords=head+first+java

(http://)shop.oreilly.com/product/9780596009205.do

also, it would be great help if you tell me what sources you used to study java(though i want some book sources.)

also, how much time on an average, if i spend 1-2 hours daily will it take me to learn java at such an extent that i can make gui and some basic games?

i know this isn't a very tech - type question but it will help me a lot.

Thanks a ton!

I've been doing C++ development for the last 5 years and need to pick up Java for a new job. Do you have any suggestions on books/websites/etc to help me with the transition?

Bruce eckel's free book : http://www.mindview.net/Books/TIJ/

CORE JAVA :

Effective Java, 2nd edition

http://www.amazon.com/Java-Generics-Collections-Maurice-Naftalin/dp/0596527756 -- book on java generics. nice.

Then again, more depends on whether you're going to build desktop apps or serverside apps.

Good luck with java

javaranch
infoq.com
theserverside.com
javablogs.com
jguru.com

Head First Java is the best book for learning Java. It's an introduction to object oriented programming, as well as Java, so as an experienced programmer you might be better served by Thinking in Java.

Knowing how Java works in initializing objects and how it bind methods and fields to an object , abstract , final methods to an object and some other issues take a lot of time to guess myself , and i needed to ensure that every guess i made was correct by asking here and there . I need some recommendations to read or watch (books-tutorials-articles-videos) , thanks in advance

I'm currently waiting for Beginning Java Objects: From Concepts to Code to arrive on my doorstep. I hope it will be what you are looking for. I am purchasing this book because I too need help understanding objects in the Java language. I think it would be best to understand how objects are used in the language, then continue studying the language itself.

After that book, I'll go onto (or read at the same time) Beginning Java 2 by Ivor Horton. Both books received really good reviews on Amazon, so hopefully they are good for both you and I.

You need to go back to basics and read a good Java introduction (just skip the parts you know), as these are realy basic Java questions you have. Most popular text is:

Head First Java (2nd edition)

Or for a more down to earth advanced text:

Core Java, Volume I - Fundementals (8th edition)

What I think you are getting at is how java really works under the hood. To that end, I think you would do well to understand byte-code, what java is interpreted to, and what the byte-code instructions mean to the jvm. By understanding what all of the Java language features convert to on a more raw level, you'll walk away with a much deeper understanding that, honestly, few people I've met have on the subject.

To this end, I'm going to suggest something that is a bit of a deviation from the norm and tell you to look at this book, Expert .NET 2.0 IL Assembler . That book is on the .NET intermediate language, the analogue to java's byte-code. I'm suggesting that simply because no good book exists on this for Java byte-code, and this is book gave me the understanding to easily tackle Java.

if you want to understand how java works i would recommend Inside Java Virtual Machine by Bill Veeners

I learnt swing basics and event handling basics from head first java... Then i read a few tutorials on swing app development using netbeans...

and i loved it as i don't have to care about layouts and stuff...

But i read in one of the forums, that i should learn swings properly rather than using netbeans directly...

This confused me a bit....

Please suggest the best way to master development of swing apps....

thanks in advance

Well, I see I'm going to run counter to the majority here ;-)

Hand coding GUIs is a pain in the ass. Anything that makes that task easier is a good thing in my book. When you're just starting, having a generated GUI lets you get up and running faster.

GUI builders handle the really repetitive work and prevent you from doing the most common dumb things. The downside is that same approach will also prevent you from doing the really clever things. Eventually, you will encounter something that you cannot do through the GUI builder and you will need to poke into the code. So, you can't treat code generators like black boxes where you don't need to know what magic happens inside. At minimum, you need white boxes. Let the GUI builder do its magic, but understand that magic and its limitations.

Practice by generating a very simple GUI. Walk through the code and understand what it does. Make a change through the builder and see how the generated code changes. Try changing the code yourself to confirm you understanding is correct. *

If you don't understand something, hit the JavaDocs, the Swing Trail, or browse through the Java2S Swing Tutorials.

If you're still stuck try the kind folks at Java Ranch, or here on StackOverflow.

* Netbeans puts the generated code in guarded blocks and will not let you edit them directly. However, you can open the file in another editor to test a change. Also, you can do quite a lot to influence the code generation using the code tab in the properties window.

I've installed Eclipse and the JDK, gone through the "Hello World" tutorial, and read through the Eclipse docs (both about Eclipse itself and developing Java with Eclipse). I'm looking at the JUnit samples to better understand how Java works when it runs.

I'm at that point of confusion one gets when learning a new computer language that has newer paradigms, and I think it's partially due to my experience with C++.

Any suggestions on good Java books/tutorials/etc. for someone with a C/C++ background?

Head First Java seems to be popular among the people I work with who come from a C++ background. If you like mathematics, solving problems on Project Euler can also be a lot of fun, doing that with Python now.

Anyone know how good thenewboston (http://www.youtube.com/user/thenewboston#grid/user/FE2CE09D83EE3E28) video series on YouTube is? I know he has a lot of subscribers and millions of views but how good are his skills from the prospective of other experienced Java programmers? I would hate to learn bad approaches.

In future you should post these sorts of questions on the Programmers Q&A site.

If you want to learn best practices your best bet is to learn from multiple sources. That way you see the content from multiple perspectives and that is the best way to gain your own perspective on the subject. You sound pretty keen on videos although to be honest I wouldn't recommend them. You can learn much more from written articles, tutorials and books like Head First Java and the official Java Tutorial etc. with examples and exercises. You cannot learn programming without doing it.

I'm still new to Java and I would like to understand Strings and Arrays so I got this idea of manipulating elements and place them according to my objective. The objective is that there will be Array of Strings "ABBCCCBBAA" and the "AA","BB" must be replaced into "A" , "BA","AB" into CC. "CC","BC" into B. I basically have no idea how to make it happen but I know it must have Arrays of String. Please help

I am assuming that by "array of strings" you mean:

String[] myvariable = new String[number];
myvariable[0] = "ABBCCBBAA";
myvariable[1] = "some_other_string";

If you are new to Java I suggest you read a beginner´s book like Head First Java and also look into java documentation; you don´t even have to go that far if you are programming with a decent IDE , like Netbeans (thanks to its intelli-sense feature) is a source of documentation for what you seek (meaning that you can look at all the methods available for a string, read what they do, and see if they can help accomplish what you need).

I am assuming (from what you have said) that you want to replace "AA" for "A", and from that result replace "BB" for "BA", and from that result replace "AB" into "CC", and from that result "BC" into "B".

The code I am posting is REAL simple, and it will only work for this particular case (as I have understood it), if you want to create a method that does this for any string, you need to change some things, but I´ll leave that to you.

String[] yourArrayOfStrings = new String[1];
yourArrayOfStrings[0] = "ABBCCBBAA";

String resultOfReplacement= yourArrayOfStrings[0].replaceFirst("AA", "A");
System.out.println(resultOfReplacement); //debugging purposes

resultOfReplacement = resultOfReplacement.replaceFirst("BB", "BA");
System.out.println(resultOfReplacement); //debugging purposes

resultOfReplacement = resultOfReplacement.replaceFirst("AB", "CC");
System.out.println(resultOfReplacement); //debugging purposes

resultOfReplacement = resultOfReplacement.replaceFirst("BC", "BB");
System.out.println(resultOfReplacement); //debugging purposes

The only reason why I created a String[] was because that's what you stated in your question, otherwise I would have simple created a String variable like I did with resultOfReplacement. To access the first element in an array you do arrayVariable[index]. Here I use the "replaceFirst" function that comes with Java for variables of type String. If you look the method up, it´ll tell you that it will look for the first match of the first parameter and replace it with the second parameter.

The System.out.println I have added are for debugging purposes, so you can see on the console what is clearly happening with each replacement. So, the first time I call replaceFirst(...) on the original string which is a[0].

This will happen:

The method will look in "ABBCCBBAA" for the FIRST AND ONLY THE FIRST time "AA" appears and replace it with "A". The result is "return" and you must assign it to a variable if you want access to it to do more actions upon it. In this case, I assign it to a new String variable. You could have just assigned back to a[0], which is likely what you want.

(You'd do so like this:
    a[0]=ourArrayOfStrings[0].replaceFirst("AA", "A"); 
)

For the second replacement, the method will look in "ABBCCBBA" for the first time "BB" appears and replace it for "BA".

See the pattern? This is just a start, and depending on what you want you might need other methods like "replaceAll()".

Most IDEs will tell you what methods are available for a variable when you access it via ".", so that when you are typing " variablename. " right at that moment a list of methods available for it should appear, if they don´t you can go ahead and do a shortcut like "ctrl+space" for it to appear and navigate through the methods via the arrow keys so you can read what they do (at least for Eclpise and Netbeans, while programming in Java, it works). Documentation is power!

I am creating an ide which will contain a workarea (a jframe) and a toolbox (another jframe). how do I accomplish the task of handling events across these two jframes? For example, if I click on a tool in the toolbox, an action has to take place in the workarea.

Please help me out

CODE FOR TOOLBOX:

import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class ToolboxForPDP extends JFrame {

/**
 *
 */
private static final long serialVersionUID = 1L;
private JPanel contentPane;

/**
 * Launch the application.
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                ToolboxForPDP frame = new ToolboxForPDP();
                frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

/**
 * Create the frame.
 */
public ToolboxForPDP() {
    setResizable(false);
    try {
        UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
        e.printStackTrace();
    }

    setTitle("Toolbox");
    setType(Type.UTILITY);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 157, 445);
    contentPane = new JPanel();
    contentPane.setBackground(new Color(245, 245, 220));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JButton btnNewButton = new JButton("");
    btnNewButton.setToolTipText("Select an element in the work area");
    btnNewButton.setBackground(new Color(255, 255, 255));
    btnNewButton.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\select.jpg"));
    btnNewButton.setBounds(10, 11, 55, 45);
    contentPane.add(btnNewButton);

    JButton btnNewButton_1 = new JButton("");
    btnNewButton_1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
        }
    });
    btnNewButton_1.setToolTipText("Insert Image");
    btnNewButton_1.setBackground(new Color(255, 255, 255));
    btnNewButton_1.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\image.png"));
    btnNewButton_1.setBounds(75, 11, 55, 45);
    contentPane.add(btnNewButton_1);

    JButton btnNewButton_2 = new JButton("");
    btnNewButton_2.setToolTipText("Insert Text");
    btnNewButton_2.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\text.jpg"));
    btnNewButton_2.setBackground(new Color(255, 255, 255));
    btnNewButton_2.setBounds(10, 67, 55, 45);
    contentPane.add(btnNewButton_2);

    JButton btnNewButton_3 = new JButton("");
    btnNewButton_3.setToolTipText("Insert Hyperlink");
    btnNewButton_3.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\hyperlink.png"));
    btnNewButton_3.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
        }
    });
    btnNewButton_3.setBackground(new Color(255, 255, 255));
    btnNewButton_3.setBounds(75, 67, 55, 45);
    contentPane.add(btnNewButton_3);

    JButton btnNewButton_4 = new JButton("");
    btnNewButton_4.setToolTipText("Change Page Background Properties");
    btnNewButton_4.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\fill color.png"));
    btnNewButton_4.setBackground(new Color(255, 255, 255));
    btnNewButton_4.setBounds(10, 123, 55, 45);
    contentPane.add(btnNewButton_4);

    JButton btnNewButton_5 = new JButton("");
    btnNewButton_5.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\textbox.jpg"));
    btnNewButton_5.setToolTipText("Insert Textbox");
    btnNewButton_5.setBackground(new Color(255, 255, 255));
    btnNewButton_5.setBounds(10, 179, 55, 45);
    contentPane.add(btnNewButton_5);

    JButton btnNewButton_6 = new JButton("");
    btnNewButton_6.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\radio Button.gif"));
    btnNewButton_6.setToolTipText("Insert Radio Button");
    btnNewButton_6.setBackground(new Color(255, 255, 255));
    btnNewButton_6.setBounds(10, 235, 55, 45);
    contentPane.add(btnNewButton_6);

    JButton btnNewButton_7 = new JButton("");
    btnNewButton_7.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\checkbox.gif"));
    btnNewButton_7.setToolTipText("Insert Checkbox");
    btnNewButton_7.setBackground(new Color(255, 255, 255));
    btnNewButton_7.setBounds(10, 291, 55, 45);
    contentPane.add(btnNewButton_7);

    JButton btnNewButton_8 = new JButton("");
    btnNewButton_8.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    btnNewButton_8.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\hr.jpg"));
    btnNewButton_8.setToolTipText("Insert Horizontal Rule");
    btnNewButton_8.setBackground(new Color(255, 255, 255));
    btnNewButton_8.setBounds(75, 123, 55, 45);
    contentPane.add(btnNewButton_8);

    JButton btnNewButton_9 = new JButton("");
    btnNewButton_9.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\button.jpg"));
    btnNewButton_9.setToolTipText("Insert Button");
    btnNewButton_9.setBackground(new Color(255, 255, 255));
    btnNewButton_9.setBounds(75, 179, 55, 45);
    contentPane.add(btnNewButton_9);

    JButton btnNewButton_10 = new JButton("");
    btnNewButton_10.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\drop-down list.png"));
    btnNewButton_10.setToolTipText("Insert Drop-Down List");
    btnNewButton_10.setBackground(new Color(255, 255, 255));
    btnNewButton_10.setBounds(75, 235, 55, 45);
    contentPane.add(btnNewButton_10);

    JButton btnNewButton_11 = new JButton("");
    btnNewButton_11.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\list.jpg"));
    btnNewButton_11.setToolTipText("Insert List");
    btnNewButton_11.setBackground(new Color(255, 255, 255));
    btnNewButton_11.setBounds(75, 291, 55, 45);
    contentPane.add(btnNewButton_11);

    JButton btnNewButton_12 = new JButton("");
    btnNewButton_12.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    btnNewButton_12.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\toolbox icons\\icoScript.png"));
    btnNewButton_12.setToolTipText("Add Script");
    btnNewButton_12.setBackground(new Color(255, 255, 255));
    btnNewButton_12.setBounds(42, 347, 55, 45);
    contentPane.add(btnNewButton_12);
}
}

CODE FOR WORKAREA:

import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import javax.swing.ButtonGroup;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.ImageIcon;
import java.awt.Toolkit;


public class StartScreen extends JFrame {

/**
 *
 */
private static final long serialVersionUID = 1L;
private JPanel contentPane;

/**
 * Launch the application.
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                StartScreen frame = new StartScreen();
                frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

/**
 * Create the frame.
 */
public StartScreen() {
    try {
        UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
        e.printStackTrace();
    }

    setIconImage(Toolkit.getDefaultToolkit().getImage("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\logos\\swami_vivekananda2.png"));
    setTitle("PageDesigner PRO(TM)");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(10, 10, 1350, 700);

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu mnFile = new JMenu("File");
    menuBar.add(mnFile);

    JMenu mnNew = new JMenu("New");
    mnNew.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\menu icons\\Folder-New-icon.png"));
    mnFile.add(mnNew);

    JMenuItem mntmNewProject = new JMenuItem("New Project");
    mnNew.add(mntmNewProject);

    JMenuItem mntmNewPage = new JMenuItem("New Page");
    mnNew.add(mntmNewPage);
    mnFile.addSeparator();

    JMenuItem mntmSave = new JMenuItem("Save");
    mntmSave.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\menu icons\\save.png"));
    mnFile.add(mntmSave);

    JMenuItem mntmSaveAs = new JMenuItem("Save As...");
    mnFile.add(mntmSaveAs);
    mnFile.addSeparator();

    JMenuItem mntmAddToProject = new JMenuItem("Add to project");
    mnFile.add(mntmAddToProject);

    JMenuItem mntmTestThisPage = new JMenuItem("Test this page");
    mnFile.add(mntmTestThisPage);
    mnFile.addSeparator();

    JCheckBoxMenuItem chckbxmntmShowWelcomeScreen = new JCheckBoxMenuItem("Show Welcome screen at startup");
    mnFile.add(chckbxmntmShowWelcomeScreen);
    mnFile.addSeparator();

    JMenuItem mntmExit = new JMenuItem("Exit");
    mntmExit.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\menu icons\\exit.png"));
    mnFile.add(mntmExit);

    JMenu mnEdit = new JMenu("Edit");
    menuBar.add(mnEdit);

    JMenuItem mntmModifyElementProperties = new JMenuItem("Modify Element Properties");
    mnEdit.add(mntmModifyElementProperties);

    JMenu mnMode = new JMenu("Mode");
    menuBar.add(mnMode);

    JRadioButtonMenuItem rdbtnmntmBeginnerMode = new JRadioButtonMenuItem("Beginner Mode");
    mnMode.add(rdbtnmntmBeginnerMode);

    JRadioButtonMenuItem rdbtnmntmAdvancedMode = new JRadioButtonMenuItem("Advanced Mode");
    mnMode.add(rdbtnmntmAdvancedMode);

    ButtonGroup modeMenuGroup = new ButtonGroup();
    modeMenuGroup.add(rdbtnmntmBeginnerMode);
    modeMenuGroup.add(rdbtnmntmAdvancedMode);

    JMenu mnHelp = new JMenu("Help");
    menuBar.add(mnHelp);

    JMenuItem mntmUserGuide = new JMenuItem("User Guide");
    mntmUserGuide.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\menu icons\\manual icon.gif"));
    mnHelp.add(mntmUserGuide);

    JMenuItem mntmAbout = new JMenuItem("About...");
    mntmAbout.setIcon(new ImageIcon("D:\\KS\\4-1\\Mini-Project\\PageDesigner PRO(TM)\\PageDesigner PRO(TM)\\resources\\pics\\icons\\menu icons\\info_black.png"));
    mnHelp.add(mntmAbout);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);
}
}

Your question is how to pass information from one JFrame to another, and this can be done as simply as having one class call a method of the other class. That you haven't done this, and that you've only posted a skeleton program, one with components but with no logic suggests to me that you are still very much a beginner Java programmer, and so my main suggestion is that first and foremost you strive to learn to code, and in particular learn about object oriented principles and how they relate to Java. Without these rudiments under your belt, we can give you code and pointers, but it won't help you much. I suggest that you go to the Java Tutorials and start there, but also that you get a decent book or two on the subject such as Bruce Eckel's Thinking in Java, and/or Head First Java.

As for your actual code I suggest that you not create classes that extend JFrame since that locks you into a JFrame, and again as per my comment above, your tool window should be a non-modal JDialog not a JFrame. If you gear your code towards creating JPanels, then you can place them into JFrames, JDialogs, other JPanels, etc... wherever needed, and so this gives you a lot more flexibility.

The main difficulty in the situation of your program is not passing information from one window to another, one object to another, really, but rather when to do so, since the program is event driven. Myself, I like to use PropertyChangeListeners for this, basically using an observer interface that is already part of the Swing GUI structure. For example in the code below I create two main JPanels, one is displayed within a JFrame, the other within a non-modal JDialog, and I pass button press information (the actionCommand String of the button) to the JTextArea in the main GUI via a PropertyChangeListener:

import java.awt.BorderLayout;
import java.awt.Dialog.ModalityType;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import javax.swing.*;

public class Foo3 {
    private static void createAndShowGui() {
        final MainPanel1 mainPanel1 = new MainPanel1();
        final ToolPanel1 toolPanel1 = new ToolPanel1();

        JFrame frame = new JFrame("Foo3");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(mainPanel1);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);

        JDialog dialog = new JDialog(frame, "Toolbar", ModalityType.MODELESS);
        dialog.add(toolPanel1);
        dialog.pack();
        dialog.setLocationByPlatform(true);
        dialog.setVisible(true);

        toolPanel1.addPropertyChangeListener(ToolPanel1.ACTION_COMMAND, new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                mainPanel1.appendActionCommand((String) evt.getNewValue());
            }
        });
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGui();
            }
        });
    }
}

class MainPanel1 extends JPanel {
    private JTextArea actionCommandArea = new JTextArea(30, 50);
    private JScrollPane scrollPane = new JScrollPane(actionCommandArea);

    public MainPanel1() {
        scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

        setLayout(new BorderLayout());
        add(scrollPane, BorderLayout.CENTER);
    }

    public void appendActionCommand(String text) {
        actionCommandArea.append(text + "\n");
    }
}

class ToolPanel1 extends JPanel {
    public static final String ACTION_COMMAND = "action command";
    public static final String[] BTN_TEXTS  = {
        "Select Element",
        "Insert Image",
        "Insert Text",
        "Insert Hyperlink",
        "Change Page Background",
        "Insert Textbox",
        "Insert Radio Button", 
        "Insert Checkbox",
        "Insert Horizontal Rule",
        "Insert Button",
        "Insert Drop-Down List",
        "Insert List",
        "Add Script"
    };
    private String actionCommand = "";

    public ToolPanel1() {
        int rows = 0; // variable number of rows
        int cols = 2; // 2 columns
        int hgap = 5;
        int vgap = hgap;
        setLayout(new GridLayout(rows, cols, hgap, vgap));
        setBorder(BorderFactory.createEmptyBorder(hgap, hgap, hgap, hgap));

        for (String btnText : BTN_TEXTS) {
            add(new JButton(new ButtonAction(btnText)));
        }
    }

    public String getActionCommand() {
        return actionCommand;
    }

    private class ButtonAction extends AbstractAction {
        public ButtonAction(String name) {
            super(name);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            String oldValue = "";
            String newValue = e.getActionCommand();
            actionCommand = newValue;
            ToolPanel1.this.firePropertyChange(ACTION_COMMAND, oldValue, newValue);
        }
    }
}

A more robust design would be to use a Model-View-Controller type design, but this is a bit more advanced, and you'll need to get some more code experience under your belt before using this, I think. also check out these links to similar questions/answers.

I am not sure if I am getting in a little too deep but I have decided i'd like to learn how to develop applications built using the Oracle technology stack.

I don't come from a programming background (I have always been on the business side) but I love that no matter what problem you encounter, you can almost always solve it with a program of some description (i know 'program' is probably the wrong word there but hopefully you know what I mean).

So my questions:

  1. Given I have no programming experience, should I be trying to start with something else?
  2. If Oracle is an ok start, from what I can ascertain i'll need to get a fair grasp of Java as well. Where should I start?

Im not necessarily looking for the quickest way, but I do want to make sure that whatever I do gives me a good understanding of what is going on.

If you don't have any object-oriented programming background, I suggest you should start out by getting familiar with basic OO concept. I recommend reading this book "Head First Java" http://www.amazon.com/Head-First-Java-Kathy-Sierra/dp/0596009208 and the official java tutorial - http://java.sun.com/docs/books/tutorial/reallybigindex.html

After you get the idea and basic concept on object-oriented programming and java. You can move yourself to use any technology including Oracle technology stack and other OO language such as python and C#.

I've been tied to several procedural applications written in PHP over the past 10 years. Two of these are going away soon, and I need to get up to speed with OOP techniques.

Are there good tutorials or books written for people who are skilled procedural coders? By skilled, I use functions heavily, and classify functions via different include files. I like clean, easy to follow code (and document accordingly). My brain has been trained to think procedurally, though experience taught me to break down code into re-usable parts (easier to maintain and update). I understand OOP is based around the same idea, but I need some help overcoming the hurdle of learning this new (to me) technique.

I've never read it myself but I've heard that Head First Java is a good book to learn OOP principles and might be helpful to you http://www.amazon.com/Head-First-Java-Kathy-Sierra/dp/0596009208

This book should be good for you http://www.amazon.com/Object-Oriented-Analysis-Design-Applications-2nd/dp/0805353402 (I've read only the first edition).

I'd advise you to keep away from php-specific books and online tutorials, because most of them are sheer rubbish.

Am a newbie in using java collection framework. What are the best possible resources online or books that I can make best use of?

Hi I'm a techie with no programing experience. I know html and css, but I'd like to someday be able to make an app for my phone (I have an android) and possibly mobile websites.

I made learning a programing language and creating a mobile app a goal for my job, and now my boss would like me to pick a programing language to learn. I found a free open course from MIT (http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/) called introduction to computer science. In the course they teach python, but more importantly it seems they teach how to think like a programmer.

When I told my boss about the free online course she didn't think that Python was an appropriate language for me to learn. She'd like me to learn a language that is more similar to one used to make Phone apps. Does anyone out there know a better language for me to pick up that would be similar to Android or iPhone's App language.

Thank you

A few things stood out to me as your goals:

  1. You want formal training on how to program (this is independent of a language)
  2. You want to learn how to develop apps for a mobile device
  3. Your boss is on board with goals 1 and 2, but wants to see the best return on her investment.

I think the easiest way for you to meet all of these goals is to start learning how to program with Java. Java is often used in introductory computer science courses, so you should be able to learn the language and programming concepts in parallel. Once you have that foundation, you will be able to start learning Android development, since Android applications are built with the Java language.

You can start off by reading some of the resources from Oracle: http://download.oracle.com/javase/tutorial/java/concepts/index.html

And there are plenty of good intro books too:

There is nothing wrong with starting off by learning Python. Once you have a good grasp of programming fundamentals, you can learn new languages relatively quickly. However, from your boss's perspective, there is more value in paying for you to learn a language for mobile development and programming at the same time.

I am going to begin my Computer Science & Information Systems degree in April. My first class is an introduction to Java programming.

Lately I have had an interest in Objective-C, but slowly declined due to lack of persistence and comprehension difficulties, (mostly some OOP). Obviously I would like to do well in my classes, so I am asking what is the best way for me to prepare?

Should I complete the Alice training and then start learning some Java on my own? Continue to work through Objective-C religiously until I see results? What do you think a newby should do?

edit: I have been reading reviews for a lot of Java books, just curious, are there any other well written beginner books? Thanks!

Objective-C probably has some barriers that will be problematic if you're learning.

I would suggest picking up a copy of either Thinking in Java or Head First Java and reading through that to get started.

When you're learning it can be useful to not be distracted by too many details. Master the basics. Learn about basic OO design. Frustration is the biggest enemy. If what you're doing seems daunting, the greater the chance you'll just give up. So keep it simple so each time you do something it feels like you're making progress.

I'd define myself as a beginner in Java, had it for just one semester and before that I had very little experience with programming whatsoever, virtually none with OOP.

Anyway, I'm going through a code and I found a method declared as a class type

public Polica stavi (Predmet p, int i)
        throws GPolIndeks, GPolZauzeto, GPolTezina{
        if(i<0 || i>=niz.length) throw new GPolIndeks (i);
        if(niz[i] != null) throw new GPolZauzeto (i);
        if(q + p.Q() > maxQ) throw new GPolTezina (p);
        niz[i] = p;
        q += p.Q();
        return this;
    }

Now the code is rather simple and almost I'm not stranger to it, except for the part where a method called "stavi" is declared. I've been thought there are two types of methods, those who return a value and those who don't, and this one does, but it is not declared as an any type regularly used (int, double, long...), it is declared with a class name, which in this case would be "Polica". This is the first time I'm coming to something like this and it works in a compiler, so my question would be, where can I read up on methods more in more detail, to better understand how this works.

The official java tutorials are a great place to start with more-ever I would recommend books like Head First Java which are really good for java beginners and will help you get a grip on java fundamentals.

Being Specific to your question java methods can return either primitives like int,float etc.,inbuilt Class object instances like Integer , or custom classes that you create in your java application like "Polica " which you have mentioned above.

Also note that within an instance method or a constructor, this is a reference to the current object — the object whose method or constructor is being called. You can refer to any member of the current object from within an instance method or a constructor by using 'this'.So in your case when your method returns 'this' and method signature says it returns 'Polica' that means that the method "stavi" is part of the Class 'Polica'and is refering to the current instance of 'Polica'.

I'm new to java and have started learning it just 2 days ago. I wasn't able to understand the meaning of:

(addition) + sign in println

System.out.println ("Count is: " + i);

and please also tell me some good book for learning java for beginners. I'm currently

reading. Programming in java A primer by E Balagurusamy

The plus operator has a double meaning. Its a concatination operator as well. As the "Count is:" is of type String the "i" (Integer?) is converted to a String as well.

I haven't read it as I prefer reference books, however some really like the Book Head First Java as it seems to explain concepts.

I'm really new to programming in general, only a few weeks in, and I've been trying to learn Android on Eclipse. However, I've been finding a lot of the tutorials and coding very difficult to understand and during a post I made on here, it was suggested by a member of this forum, that I learn some basic Java and abstract concepts like models, views, controllers, etc, so I can learn how to implement them and to help me understand Android a little better :) So on that note, I was wondering if it was possible for anybody to suggest a website or youtube channel, or better yet, maybe a torrent containing both video and written annotations, where I could learn some basic Java and all the 'abstract' concepts, in a well annotated fashion :)

Thank's for your time :D

I would recommend reading Head First Java by Kathy Sierra and Bert Bates. A little different reading style, but pretty good for beginning/learning and easy to read.

Another place that is invaluable is the Java Documentation.

Really, though, your best bet is to just dive in and write code. Not necessarily Android code, or the project you want to work on, but rather tutorial code and example code online. Here are a handful of tutorials which you may find useful:

  1. File basics tutorial
  2. Swing GUI tutorials
  3. Databases with JDBC tutorial
  4. Collections tutorials

I'm revising my Java book to make sure i have solid understanding of objects and Java basics in general. I stumbled upon this piece of code from the book i was reading Head First: Java 2nd edition (2005)

 class Book {   

     String title;
     String author; 

 }

 class Main {

    public static void main(String args[]) {    

        int x = 0;      

        Book[] myBooks = new Book[3];
        myBooks[0] = new Book();
        myBooks[1] = new Book();
        myBooks[2] = new Book();
        myBooks[0].title = "Example title xx";
        myBooks[1].title = "Example title cc";
        myBooks[2].title = "Example title yy";
        myBooks[0].author = "Example author xx";
        myBooks[1].author = "Example author cc";
        myBooks[2].author = "Example author yy";    

        while (x < 3) {     

            System.out.print(myBooks[x].title);
            System.out.print(", author ");
            System.out.println(myBooks[x].author);
            x = x + 1;  

        }       
    }   
}

I don't quite understand the syntax of myBooks[0].title = "Example title xx" I admit i'm not quite experienced with arrays and how they work yet, but isn't it a better practice to loop through the array and set all the object fields with setter methods?

What i think is the case here

From my limited understanding, This particular method of assigning values to those fields is related to the scope of those two classes. The same way you'd use names of the static methods instead of first creating object of their respective classes, but with static variables instead.

It seems very trivial, but it's very important for me to understand and grasp the idea. I hope you can clear it up for me.

First, let's rewrite your program without an array:

Book myBooks0, myBooks1, myBooks2;
myBooks0 = new Book();
myBooks1 = new Book();
myBooks2 = new Book();
myBooks0.title = "Example title xx";
myBooks1.title = "Example title cc";
myBooks2.title = "Example title yy";
myBooks0.author = "Example author xx";
myBooks1.author = "Example author cc";
myBooks2.author = "Example author yy";  

If you understand Java variables referencing cusom classes, this should be no mystery at all.

Next, let's go back to your array:

Book[] myBooks = new Book[3];

It replaces three named variables above with one array variable, so now instead of writing myBooksX we write myBooks[X].

That's most of the difference between the two. The advantage of an array is that X can be a variable or an integer expression that evaluates to 0, 1, or 2, while with individual variables the number must be hard-coded.

I've been reading StackOverflow for quite a while now and I'm only now building the nerve to ask a question. I'm 20 years old and currently enrolled in college in IT here in my hometown (Cluj-Napoca, Romania). Enough for introductions :D.

Basically I have my little software firm that provides Book-keeping appz. They're (horrifyingly) written in Delphi and I want to start from scratch and write them in Java. I've had little experience with Java in the past but I want to learn and I've chosen Java because of the cheap and quality tools the platform offers.

Now could you please point me to the right direction as where could I find some complete documentation (books, web-sites, blogs etc) as where to get some info on properly building database applications including design patterns with DBs(my choice is PostgreSQL and have already ordered a book) and also Java. I know I won't be able to get it right the first time but at least get it close to right.

Thank you

Head First Java is a great place to start.

Head First Java

This is my first program in java and I haven't found any good websites like this one for C++ and it's confusing for me because I just started writing java and I just came from C++. Anyways, concerning this code, could someone explain how to fix this code because of the line containing Scanner and/or how to simply receive inputs, because I haven't found any simple way to translate cin >> from C++

public class input {
    public static void main(String[] args) {
        double total = 0;          
        Scanner in = new Scanner(System.in);
        System.out.println("As you enter numbers, they will be added.");
        System.out.println("Entering a non-number will stop the program.");

        while (in.hasNextDouble()) {
            double n = in.nextDouble();
            total = total + n;
            System.out.println("The total is " + total);
        }
    }
}

Your code works. Just make sure you have import java.util.Scanner. On a related note, use Eclipse or Netbeans as they would have told you this. Also, you should capitalize class names and put your class in a package instead of in the "default package". I recommend "Head First Java".

package sand1;

import java.util.Scanner;

public class Input {
    public static void main(String[] args) {
        double total = 0;
        Scanner in = new Scanner(System.in);
        System.out.println("As you enter numbers, they will be added.");
        System.out.println("Entering a non-number will stop the program.");

        while (in.hasNextDouble()) {
            double n = in.nextDouble();
            total = total + n;
            System.out.println("The total is " + total);
        }
    }
}

Here is output when I ran it. I think I might consider it a bug that I was able to hit enter with a blank line without it ending.

run:
As you enter numbers, they will be added.
Entering a non-number will stop the program.
12.2
The total is 12.2
43
The total is 55.2

a
BUILD SUCCESSFUL (total time: 11 seconds)

I am currently doing a uni assignment as a fresher so I'm not very experienced with coding.

The assignment is to allow the user to create a class diagram. Currently I have a secondary frame that the user inputs a UML design of the class in a JTextArea and then this should be passed through to my GUI by taking what the user wrote and drawing the string (drawString) onto the created class.

Currently I am getting a nullpointerexception when trying to get the String from the JTextArea to drawString and I don't understand this because surely inputUML.getText() would be a String so should be able to be passed through?

This is the class that I am trying to pass the string into

package main;
import java.awt.*;
import javax.swing.*;
import classdesign.ClassCreation;



public class GroupCreateClass {
private double x;
private double y;
private double r;
private String message;
private String classdesign;


public GroupCreateClass(double x, double y, double r) {
    this.x = x;
    this.y = y;
    this.r = r;
}

public void draw(Graphics g) {
    makeRectangles(g);
    deleteBox(g);
    userdesignofclass(g);
}

public void makeRectangles(Graphics g) {

        g.drawRect((int)Math.round(x-r),(int)Math.round(y-r),
            (int)Math.round(325.0*r),(int)Math.round(350.0*r));

        g.drawRect((int)Math.round(x-r),(int)Math.round(y-r),
            (int)Math.round(325.0*r),(int)Math.round(19.5*r));

}

public void deleteBox(Graphics g) {

        g.fillRect((int)Math.round(x-r),(int)Math.round(y-r),
            (int)Math.round(19.5*r),(int)Math.round(19.5*r));
}

public void userdesignofclass(Graphics g){

    message = new String("Class");
    g.drawString(message,(int)Math.round(x+140),(int)Math.round(y+15));

    classdesign = (String.valueOf(inputUML.getText())); // This is the code that is giving me a nullpointerexception. I don't understand why, as surely inputUML.getText() should be a String...?
    g.drawString(classdesign,(int)Math.round(x+200), (int)Math.round(y+15));//
}


public double distanceTo(double x, double y) {
    return (Math.abs(this.x-x) + Math.abs(this.y-y));
}

public void update(double x, double y) {
    this.x = x;
    this.y = y;
}


}

This is the class that has the JTextArea, it is in another class and package, but the class that should be retrieving the string Extends this class.

 package classdesign;
 import java.awt.*;

 import javax.swing.*;

 public class ClassCreation extends JFrame {

private JFrame frame;
private JLabel instructionlabel;
protected JTextArea inputUML; //This is the JTextArea containing the text that I am trying to pass through.
private JButton create;

public void initGUI(){

   frame = new JFrame();
   frame.setSize(325, 350);
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setTitle("Class Design - Fill in Class UML");

   JPanel CreationPanel = new JPanel();
   CreationPanel.setLayout(new BorderLayout());

   inputUML = new JTextArea("Write UML here");
   inputUML.setLineWrap(true);
   inputUML.setWrapStyleWord(true);
   CreationPanel.add(new JScrollPane(inputUML),BorderLayout.CENTER);
   CreationPanel.add(inputUML,BorderLayout.CENTER);

   Create = new JButton("Create Class");
   CreationPanel.add(Create,BorderLayout.SOUTH);
   //Create.addActionListener(this);


   frame.add(CreationPanel);
 }

 public Frame getFrame() {
       return frame;
   }



 }

So what I want to know, simply, is how I can fix that, is there just a line I'm going wrong? or do I have a massive logic problem in what I'm trying to achieve?

Thanks :)

The simple answer to your question is that it's quite possible you haven't instantiated inputUML [ostensibly by calling initGUI()] before calling strings() [which is a terrible name for a method].

But your problems go far deeper than this. This use of inheritance is completely wrong. Favor composition over inheritance. The use of Magic Numbers is not recommended. The variable names are poor (Java is case sensitive, btw. uml is not the same as UML)...do yourself a favor and start browsing Head First Java and Head First Object Oriented Analysis and Design. Also consider Test Driven Development by Example I know you think you don't have the time, but it's much harder to unlearn bad habits than take a little extra time at the beginning to build good ones.

i have been trying to make an easy calculator

    import java.util.Scanner;

    public class Math {

    static Scanner input = new Scanner(System.in);

    private static void Add(int a, int b,int c){

        System.out.println("First nummber...");
        a = input.nextInt();
        System.out.println("secound nummber...");
        b = input.nextInt();

        c = a + b;

        System.err.println(c);



    }

    public static void main(String[] args) {

        Add();

    }

}

but i got this error " The method Add(int, int, int) in the type Math is not applicable for the arguments () "

i tried then to add the variables to the Add() in the main function

public static void main(String[] args) {

    Add(a,b,c);

}

and then i got this error " Multiple markers at this line - b cannot be resolved to a variable - c cannot be resolved to a variable - a cannot be resolved to a variable "

How can i call the Add() function ?

You can re-write your code like this.

import java.util.Scanner;

public class Math {

   static Scanner input = new Scanner(System.in);

   private static int Add(int a, int b){    
       return a + b;
   }

   public static void main(String[] args) {
       System.out.println("First nummber...");
       int a = input.nextInt();
       System.out.println("secound nummber...");
       int b = input.nextInt();
       int c = Add(a,b);
       System.out.println(c);        

   }

}

But from your code I can see that you are really new to java perhaps new to programming. So I will recommend you to learn basic java and programming first. You can learn online from

Or can read some books

I have gone to the Java jdk site should I download just JDK7, JDK7+Netbeans or JDK7+Jave EE?

This should help Head First Java

I have written the following code (was a puzzle from "head first Java")

http://pastebin.com/9RmyUqZr

The goal is for it to print out DooBeeDooBeeDo which I think I got right. I want to run this program now though and see it work how would I go about doing so? I have the JDK installed and working so dont worry about telling me that part. The book I am reading shows something like this (assuming you enter these commands in the cmd):

save: doobee.java
compile: javac doobee.java
run: %java DooBee

When I follow those instructions I get this in the cmd:

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\James>javac -version
javac 1.6.0_25

C:\Users\James>javac doobee.java
doobee.java:1: class DooBee is public, should be declared in a file named DooBee
.java
public class DooBee {
       ^
doobee.java:8: package system does not exist
 system.out.print("Doo");
       ^
doobee.java:9: package system does not exist
 system.out.print("Bee");
       ^
doobee.java:14: package system does not exist
 system.out.print("Do");
       ^
4 errors

C:\Users\James>%java doobee
'%java' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\James>

So how can I get my very simple first program to run?

Rename doobee.java to DooBee.java, and change system.out.print to System.out.print. Java is rather case-sensitive.

I've found multiple resources to learn Java programming, but all of them assume prior programming experience with another language.

Does anyone know of a good, preferably entertaining, resource to learn the basics of computer programming using Java?

The reason it must be Java is that the learner will be using it in a course in the near future.

Thank you

I agree with Jasonw. Think Like a Computer Scientist (Java Version) is a great resource for a few reasons.

  1. It doesn't assume prior knowledge. It starts out with "What is a programming language."
  2. It teaches computer science concepts instead of just the Java language
  3. It's free.

http://www.greenteapress.com/thinkapjava/

Personally, I learned programming on "Beginning Programming with Java for Dummies." It goes slow and doesn't assume anything. I think it even shows you how to get your classpath set up so you can run javac from the command prompt. I used this as a jumping off point (I reordered some chapters and added material) for building my own curriculum when I taught an introduction to programming course.

Try the "Head First" series. Kathy Sierra has put a lot of thought into making the presentation fun and educational.

i want to learn coding web apps with java using glassfish.

i have bought a book "Beginning JAVA EE 6 Platform with Glassfish 3 - From Novice to Professional". I wonder if I can jump to this book directly or do I need to read a book about JAVA SE first?

I just want to develop web apps and not desktop applications nor browser java applets.

Thanks in advance.

Learning Java SE is not only learning to develop desktop applications or applets (which are basically just Swing/AWT). You learns how to use and write basic Java code and to make use of the basic Java SE API's. You still need them in Java EE. You'll need to write plain Java SE code in the Servlet methods, the DAO classes, the domain/model objects, etcetera. In practically all classes which you need to implement/create for Java EE.

So yes, I can strongly recommend to learn Java SE first, if not done yet. Sun has nice tutorials about that, check the chapter Trails Covering the Basics. If you prefer a book, then I can recommend the Head First Java and/or maybe the SCJP6 book of the same authors. You can however skip any Swing/AWT chapters. You don't need to know about them in Java EE.

My work is going to be taking on a RESTful API project that will be built in Java-EE and JAX-RS. I'm very interested in getting a jump start on learning Java-EE and building this type of application because I definitely want to be involved as to take full advantage of the opportunity to learn. I have a background with PHP/Javascript/MySQL. I'm not entirely sure if MySQL will be the database of choice, but right now I need to assume it will be.

What's the best way to setup a RESTful API? What are things that need to be considered? How should security be handled?

Here's an excellent tutorial that might get you started in the right direction:

http://www.myeclipseide.com/documentation/quickstarts/webservices_rest/

Choice of database is relatively unimportant (at least for learning purposes).

If you don't already know Java, then you should definitely dedicate time to learning it. I'd recommend Headfirst Java as a good introduction:

http://www.amazon.com/Head-First-Java-Kathy-Sierra/dp/0596009208/

I am learing core java and practicing it. I understand the concept of method overloading. But when I run the below program it shows error as "

constructor Methodover in class Methodover cannot be applied to given types;
        Methodover m2 = new Methodover();
                        ^
  required: int,int
  found: no arguments
  reason: actual and formal argument lists differ in length"

Please find my code below and help.. I am just learning.

public class Methodover
{   
    int x;
    int y;

     Methodover(int a, int b)
    {
        x=a;
        y=b;
        System.out.println("The values assigned are" +x+ "And" +y);

    }

    void multiply(Methodover obj)
    {   obj.x = 2;
        obj.y = 2;
        System.out.println("The multiplication result with object passed is" +obj.x*obj.y );

    }
    public static void main(String[] args)
    {
        Methodover m1 = new Methodover(5,6);
        Methodover m2 = new Methodover();
        m2.multiply(m1);

    }

}

The default (zero argument) constructor is like a lawyer that represents you in the court. If you don't have one - JVM will provide it for you, but if you have one - the default won't be there :-) (I took this metaphor from Head First Java, a great book for any beginner in Java language and OOP)