This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Looking for Java exercises

 
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
 
Ranch Hand
Posts: 157
1
Android MySQL Database Java
  • 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?
 
Ranch Hand
Posts: 32
Eclipse IDE Tomcat Server Java
  • 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
 
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
 
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.
 
Marshal
Posts: 67515
257
  • 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
Marshal
Posts: 67515
257
  • 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
Marshal
Posts: 67515
257
  • 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
Marshal
Posts: 67515
257
  • 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.
  •  
    Everyone is a villain in someone else's story. Especially this devious tiny ad:
    Java file APIs (DOC, XLS, PDF, and many more)
    https://products.aspose.com/total/java
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!