It depends on how you look at energy. A medium apple contains about 100 calories and approxametly 20 grams of sugar. The calorie elements in one apple includes protien, fats and carbohydrates like sugar and starch. Your body will process these nutrient molecules into adenosine triphosphate or ATP. ATP is literally fuel for your cells and they use it for everything they do that requires energy.
Coffee on the other hand stimulates your fight or flight system causing your heart to beat faster and blood to flow to your peripheral muscles. Your nervous system is stimulated but since coffee contains little calories, your body is not creating fuel for your cells. So while "stimulating" coffee won't give you sustained energy like an apple will.
Apples are also great sources soluble fiber, vitamin C and antioxidants called polyphenols. They are rich in fructose, which is the predominant sugar found in fruits. Fructose takes more time to be metabolized into glucose, so it’s a good energy source that doesn’t spike blood sugar levels too dramatically. Eating an apple will give you a steady supply of glucose to your brain and muscles for at least an hour or so.