• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Looking for Java exercises

 
Sezar Denizer
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 157
1
Android Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This book is the best for SCJP preparation

SCJP Sun Certified Programmer for Java 6 Study Exam 310-065 Guide
 
Vijay kumarIdbi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 50278
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
I looked at the first exercise there, and I am afraid I was not impressed.
 
Abu Bakr
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 50278
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 50278
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomorrow has come; have we got a copy of that first exercise, about reversing arrays, please.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50278
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  •  
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic