We study X-ray and variability and distance of GX 339–4 . We derive the distance of \ga 7 kpc , based on recent determination of the binary parameters . We study data from the ASM aboard Ginga , the BATSE aboard CGRO , and the ASM , PCA and HEXTE aboard RXTE . From 1987 to 2004 , GX 339–4 underwent \sim 15 outbursts and went through all known states of black-hole binaries . For the first time , we present the PCA data from the initial hard state of the outburst of 2004 . We then study colour-colour and colour-flux correlations . In the hard state , there is a strong anticorrelation between the 1.5–5 and 3–12 keV spectral slopes , which we explain by thermal Comptonization of disc photons . There is also a softening of the spectrum above 3 keV with the increasing flux that becomes stronger with increasing energy up to \sim 200 keV . This indicates an anticorrelation between the electron temperature and luminosity , explained by hot accretion models . In addition , we see a variable broad-band slope with a pivot at \sim 200 keV . In the soft state , there is a high energy tail with varying amplitude beyond a strong and variable blackbody component . We confirm the presence of pronounced hysteresis , with the hard-to-soft state transitions occurring at much higher ( and variable ) luminosities than the soft-to-hard transitions . We fit the RXTE /ASM data with a model consisting of an outer accretion disc and a hot inner flow . State transitions are associated then with variations in the disc truncation radius , which we fit as \sim 6 GM / c ^ { 2 } in the soft state and several times that in the hard state . The disappearence of the inner disc takes place at a lower accretion rate than its initial appearance due to the dependence of the transitions on the source history . We provide further evidence against the X-ray emission in the hard state being nonthermal synchrotron , and explain the observed radio-X-ray correlation by the jet power being correlated with the accretion power .