This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

How do you practice?

 
Ranch Hand
Posts: 56
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was about to dive into android developments, but after a few chapters I felt that I need some more practice with java.
Where can I find exercises? I tried codingbat.com, but the questions are all about algorithms and not object oriented concepts, and the latter is where I need most practice.

Any books? Websites may be? I tried googling this but not sure where to go
Also where can I find java programs made by other people with the source code?
 
Sheriff
Posts: 6381
172
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to practice OOP then the coding sites like Hackerrank are probably not the best. How about creating a project for yourself?

You could create a little bank transaction system with Bank, Account, Transaction, etc.

A TicTacToe game with Player, Board, Game, etc.

If you like cars, how about a software car with Car, Body, Transmission, Engine, Brakes, etc.

Or anything else you might want to do.
 
Ahmad Auada
Ranch Hand
Posts: 56
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Knute Snortum wrote:If you want to practice OOP then the coding sites like Hackerrank are probably not the best. How about creating a project for yourself?

You could create a little bank transaction system with Bank, Account, Transaction, etc.

A TicTacToe game with Player, Board, Game, etc.

If you like cars, how about a software car with Car, Body, Transmission, Engine, Brakes, etc.

Or anything else you might want to do.



I tried to build a virtual asstiant, but I'm not sure that I applied the oop concepts correctly. Thats why I want some exercises with answers, or atleast some programs with the source code made availble
 
Knute Snortum
Sheriff
Posts: 6381
172
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if this is the best place for code review, but if you post your code to GitHub, I'd be happy to take a look at it.
 
Ranch Hand
Posts: 65
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I present you a problem from which you can learn a lot if you are a beginner.
I hope I haven't missed some important details.

Definitions:
A polyline is a line composed of one or more edges (line segments). An endpoint is a vertex.

Problem:
Create a class that models a 2-dimensional point, that has:
1. a name, x-coordinate, and y-coordinate
2. two constructors:
public Point(String name, int x, int y)
public Point(Point P)
3. getter and setter methods
4. an instance method that returns the distance between this point and another point
5. equals() and toString()

Now make a polyline class that makes use of your Point class. Your polyline class has to implement the following interface:

Furthermore, have these two constructors:
public PolylineClassName () // choose a good class name
public PolylineClassName (Point[] vertices)

And a toString() method would be also good.
You can now test your classes in a main method.

What you will learn:
1. interfaces
2. iterators
3. the Iterator<E> interface, here is an introduction: https://www.youtube.com/watch?v=zALZ_8epoQ0
4. anonymous classes
5. how to override and implement equals() properly
6. how to implement getter methods properly so that they don't violate encapsulation
etc...

If you want an extra challenge, you may implement another polyline class using a linked list.
Also, if you need a problem on inheritance and nested and abstract classes, tell me.
 
After some pecan pie, you might want to cleanse your palatte with this 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!