how we will know that an object has a negative charge or a positive one
Electron has negative charge by convention.
So we can determine nature of charge on any object with respect to the electron.
If electron attracts some charge particles, then the charge particle has positive charge.
If electron repels some charge particles, then the charge particle has negative charge.