File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Looking for Java exercises Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Looking for Java exercises" Watch "Looking for Java exercises" New topic
Author

Looking for Java exercises

Sezar Denizer
Greenhorn

Joined: Sep 19, 2012
Posts: 2
Hi all,

I'm looking for some exercieses to practice my Java.
Two weeks ago I had following Java training: Java Programming Language, Java SE 6 (SL-275-SE6). This was a training with Java Basics. Now my boss wants me to become a OCJP/SCJP. But I think I'm not ready to manage that test without enough practice.

Can anyone help me to find some exercises?



Kind regards
Sezar
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

Hi Sezar, i think first you should read apis and practice before taking any exam. I recommend you to solve the problems posted here, this will give you enough understanding about java. Also java book by kathy siera is recommended to enhance your knowldge in a systematic way. Hope this will help you.
Sezar Denizer
Greenhorn

Joined: Sep 19, 2012
Posts: 2
Hi Harshvardhan,

thank you for your reply. Can you tell me where I can find the posted problems and what's the books name?
Saket Kumar Sinha
Ranch Hand

Joined: Aug 04, 2011
Posts: 32

This book is the best for SCJP preparation

SCJP Sun Certified Programmer for Java 6 Study Exam 310-065 Guide
Vijay kumarIdbi
Greenhorn

Joined: May 14, 2012
Posts: 4
Hi
You can try www.codingbat.com it has small examples for you to solve and they will test it with many values for your logic test.

Regards
Vijay kumar
Abu Bakr
Greenhorn

Joined: Feb 07, 2013
Posts: 2
Hi,

You can find exercices for beginners at javaperspective.com. Read the entire beginner section if you want a good grasp on Java basics. I Hope this helps.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
Welcome to the Ranch
I looked at the first exercise there, and I am afraid I was not impressed.
Abu Bakr
Greenhorn

Joined: Feb 07, 2013
Posts: 2
Thanks Campbell,

It's a beginner exercise. Given your 30613 posts, I'm afraid you will not get impressed by a beginner exercise for a very long time .
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
30614 now, soon to be 30615.
I would have been impressed by a good beginners’ exercise, but I can see several style problems with the first suggested solution. Post the first solution and I promise to find 4 things wrong with it. But not until tomorrow.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
Tomorrow has come; have we got a copy of that first exercise, about reversing arrays, please.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
Even if you don’t post the exercise’s solution, I shall not look at it, but shall tell you what I think it wrong with it, from memory:-
  • 1: Minor point. Use of return twice in the same method. Some people do not regard this as an error, however.
  • 2: Minor point: the use of i-- and index++ is confusing. Use index - i.
  • 3: Minor point: It would be better to iterate the array forwards, rather than using i--.
  • 4: Minor point: Wrap the entire body of the method in a test for whether the array’s length is greater than 1. You can’t reverse an array with ≤ 1 member! This is linked with point 7, however.
  • 5: Moderate point. That method takes all information required from its parameters, and passes all information back via its return type, so it ought to be static.
  • 6: Major point: that method has the dangerous possibility of returning null. It would be better simply to throw an Exception. Beginners using it might not know how to throw Exceptions, so they should forget about the possibility of nulls and let the JVM throw its own Exceptions. It might say return null in the question, but that is a dangerous thing to do
  • 7: Major point. That method does not do what the question asked for. It does not reverse the array, but creates a copy array in reverse order.
  •  
    Don't get me started about those stupid light bulbs.
     
    subject: Looking for Java exercises