The G major scale is closely related to the C major scale. G is the fifth note in the C major scale. The pattern of whole steps (w) and half steps (h) of any major scale is w-w-h-w-w-w-h. Starting on G, this pattern fits almost entirely on the white keys of the piano, except for the seventh note. To get the final whole step and half step of the pattern to fit, the seventh note (F) must be raised a half step. This raised note is called F# (“F sharp”) and on the piano it is the black key to the right of F.
This is indicated at the beginning of each musical staff by putting a sharp (#) symbol on the line corresponding to F. This tells the musician that every F on the staff should be sung or played as an F#. This applies not just to notes on the F line of the staff, but notes on the bottom space and other lines and spaces representing Fs in other octaves.
This single sharp symbol on the F line is called the key signature of the key of G major. It looks slightly different in the bass clef because the line corresponding to F is the second one from the top.