• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

How do you practice?

 
Ranch Hand
Posts: 56
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7113
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7113
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Happily living in the valley of the dried frogs with a few tiny ads.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic