The answer to your question is: no, as long as the system you're referring to implies no friction, there are no external forces, and the material the two ball are made of can be ignored.
In Classical Mechanics, the linear momentum of a body (any object) is defined as mass times velocity, p = mv, and it is a vector, so that you can consider the linear momentum of an object as the sum of its components along the system axes (x and y, for example).
One of the common reasons linear momentum exists is to deal with collisions between objects, as there's need to give each object involved a magnitude of 'something' to compute the final state of the system, thus the speed and direction of an object after a collision.
Physicists (and matematicians too...) obtained a nice formula to get the velocity of two object O1 and O2 after they collide each other by working out the equation system of the two objects' linear momenta and their kinetic energy, there it is:

Here, v is the velocity vector, m the mass, f and i stand for 'final' and 'initial', thus after and before the collision occurs respectively. The indexes 1 and 2 are used to refer to one of the two objects you are considering for the collision. There's no difference about who is object 1 or 2, as long as you still refer to the same object during the calculations. Also, this formula can be used to compute collision between more than two objects by working on their couples. For example, if three ojects collide each other at the same time, all you need to do (although this is just an approximation) is to apply the formula to object 1 and 2, 1 and 3, and finally to object 2 and 3.
Anyway, if you figure out this formula, you will notice that any final velocity depends on the object masses, but if you consider the two masses the same, velocities are just exchanged betweeen the two objects as final result.
Back to your question. What ball will jump higher? Let's have two schemes, the first is the collision between ball 1 and the pavement, the second one between ball 2 and the same pavement. For each scheme, we'll consider the pavement indexed as '2' in the formulas. Since the pavement has infinite mass, someone would be in trouble multiplying or dividing by infinite. We could apply mathematical calculus to obtain the velocities, OR we can rely on the Law of Conservation of Linear Momentum which says that inside an isolated system (a system where there's no friction) the momenta of every object is conserved entirely.
That means that an object with momentum mv directed downwards (the ball) collides with a fixed non-moving object with infinite mass (the pavement) should still have a momentum of mv regardless of the sign. And since the pavement is not supposed to move, the ball is then moving upwards with the same speed, despite several balls may have different masses.
So, your two balls will bounce to the same height, as equations of motion tell us.
As for the sample code, you can just adapt the above formula so that every object involved performs the first equation only on itself, where the object calling the function has index 1 and the other has index 2 referred to the formula:
...
Ball a = new Ball(5); // Mass is 5
Ball b = new Ball(8); // Mass is 8
...
if (collision(a,b)) { // Any collision check algorithm
a.collide(b); // Call
b.collide(a); // Call
}
...
Your function may look somehow like this:
void collide(Object other) {
this.speed = (this.mass-other.mass)/(this.mass+other.mass)*this.speed+(2.0*other.mass/(this.mass+other.mass))*other.speed;
}
This is just a hint about how to write your code; you can think of any possible implementation depending on your needs.
BUT, if you want to better simulate reality, your balls should bounce at different heights as time goes on. Any collision between two objects depends not only on masses and velocities, but also on centers of mass, angular momentum, friction, and the materials the objects are made of. A steel ball and a wood ball will bounce lower than a tennis ball, but that's because of the coefficient of restitution, the energy loss due to the sound of impact and heat generated... But that's physics stuff, as much interesting as boring (well, not for everybody). Usually you would implement a friction system so that a ball will stop sometime in the future when rolling on the floor, but that will influence the motion attitude of the ball too. I suggest further readings if you want to deepen this argument.