When music is talked of as being in a particular key, it means that the melody is based upon the major/or minor scale with the same name e.g. in the key of C, C major scale notes (i.e. C, D, E, F, G, A and B) will occur much more frequently than notes that do not belong to the C scale (i.e. sharpened and flattened notes).
In the key of G, G scale notes will be most common (i.e. the notes G, A, Bt C, D, E and F# will occur frequently). You will notice here a sharp sign is placed on the F line (the top one) of the staff at the beginning of each line. This is referred to as the key signature: thus the key signature of G major is F#.
Below are the key signatures for all keys. Each key signature applies to one major key and one minor key. These are called relative keys and are discussed on the following page.
It can be seen, then, that each key signature is a shorthand representation of the scale, showing only the sharps or flats which occur in that scale. Where an additional sharp or flat occurs, it is not included as part of the key signature, but is written in the music, e.g- in the key of G, if a D# note occurs, the sharp sign will be written immediately Before the D note, not at the beginning of the line as part of the key signature. These notes are called accidentals.