Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

need advice on java

Jul 25, 2007 4:15AM PDT

well i m learning java. I read and understand the various chapters but unless you practice programs it useless. can anyone tell me where can i get the practice problems or programs for better practice of java. thank u

Discussion is locked

- Collapse -
Well...
Jul 25, 2007 4:58AM PDT

Guess that all depends on what you mean. I can't quite tell if you're talking about examples from a book, or just looking for some program to poke and prod a bit, make changes to, etc, to get a feel for the language in practice.

In the case of the former... They probably should have come on a CD included with the book, or one of the early chapters will list a website where you can download the code examples. Another good idea I've seen suggested, is to create a program that has a list of all language keywords that you've learned up to that point, a brief description of what each one does, and maybe even a short example. Make this into a sort of reference guide program for yourself. Text based at first, and then when you start learning about AWT, Swing, SWT, etc, you can add a GUI to it. Maybe eventually put all the language information into a database, and have the program pull it out.

In the case of the latter... I would suggest visiting the SourceForge website. It's a sort of gathering point for open source projects, many of which may be done in Java. You could find one that interests you, and maybe is just starting out, so you don't have to spend all the time familiarizing yourself with the code base. Or you could maybe take up work on an abandoned project. Another good idea, is to find an existing program that is of reasonable size, and volunteer to go through the code base and add comments that document the code. It's a good way to really familiarize yourself with "real world" Java code, learn the ins and outs of a particular program at the source level, and it's a useful service. Most developers HATE commenting code, even though they know it's highly useful if you need to come back to some bit of code 6 months later, and you can't remember what in the world it does. Over time you can start making small additions of your own... Fixing an odd bug here and there, making some small improvement... Working your way up to being one of the core developers.

- Collapse -
thanks
Jul 26, 2007 3:19AM PDT

what i actually mean is that i am learning java and a beginner, so i need problems i.e. programs, not very tough ones,but some exercises that help me understanding the basics of java(from the statrting).

- Collapse -
Welcome to programming
Jul 26, 2007 3:59AM PDT

That's always been my problem as well. I've probably learned a half dozen languages, but when I go to try and figure out something to do with them... Nothing.

Best I can say, is look over Java projects at SourceForge, and grab a copy of the source. Look it over, and maybe try to make small changes to it. Then gradually get more and more complex as you go. It's slow and tough going at first, but it does tend to get easier in time. Like many things, it just takes some practice.

You should also be sure to type in all the example programs in the book. Just to help reinforce everything in your mind as many times as possible. And if you happen to have one of those "in X Days" or "X Minutes" books... Do yourself a favor and get a different one. Almost as a rule, those books are all complete garbage and will do more harm than good. I don't really know of any Java books to recommend, but almost anything from O'Reilly Publishing is money well spent.