how to make a BALL JOINT in solidworks?????
In terms of real life applications, you will need to consider what material you are using. In the 90's, toy manufactures used plastic that was somewhat flexible for their ball-joints so that instead of the joint sheering off, the arm simply popped off the shoulder and you could pop it back on. If you were to do it like this, you would make a cylinder with a sphere at the end of it, and on the opposite side, you would need a hole of an equivalent diameter in an object with a slot-groove along the outside of the object connecting to the hole. Make sure that the slot is not wider than the diameter of the ball, otherwise it will easily fall out, but the difference cannot be too great otherwise you could not pop the joint in and out.
If the "Slot" is simply just a hole connecting ball to the pocket/socket, then you will only get a range in motion on a single axis rotating about the hole.
But once you expand the hole into a groove so it wraps around the body the pocket/socket is in, then you can allow range in motion along 2 axii and thus you have a ball joint.
(Optional) In order to get a slight twist, the slot needs to have a chamfer on its outer edge or rather, it needs to be wider than the peg the ball is on. The difference between the width of the slot and the diameter of the peg determines how much wiggle/twist you allow. While it isn't always desired to have this, it is an option... but I wouldn't suggest it in SolidWorks, it is better to have the slot flush with the peg for mating purposes, otherwise animating is NOT going to be fun.
Now the reason why I mentioned the material up front, is because if you are using something like metal, the cup/pocket/socket body will need to split into two bodies that will need to be assembled. With this, 1 body will likely only be a half-cup, while the other half will have the groove in it and the other side of the cup; this piece with the groove in it may appear U-shaped because of the groove. For assembly, you would hook the U-shaped piece around the Ball, and then fasten the U-shaped piece to the opposite cup-body.
I have included an image of a K'Nex toy ball-joint that has 360 degrees of rotation on the roll axis, over 180 on the pitch axis, and some wiggle room on the yaw axis. It is not a good of example of what I was explaining in terms of the metal assembly, but it does work in terms of a plastic example. This ball-joint is held together by force of the plastic of the socket stretching because the ball is marginally larger. Frequent popping in and out will fatique and loosen the joint.
I hope everything makes sense!