I tried taking a picture of something through some trees but my camera keeps focusing on the trees instead of what is behind the trees. How can I focus on what is behind the tree?
You can focus manually.
To do that with the Nikon AF-S DX NIKKOR 18-55mm f/3.5-5.6G VR II supplied as the kit lens with the D3300, you need to slide the switch on the lens to M for manual focus. It's the switch labeled "A-M" for "Auto Focus"/"Manual Focus". With many non-SWM lenses with an "A-M" switch (AF/M switch on non-USM Canon lenses) you should not attempt to manually focus with the switch set to autofocus as it can damage the lens. Only manually focus with the switch set to "M".
If your camera has live view, it may be easier to get the focus right as you can watch on the display and zoom in to see if the focus is exactly correct. Otherwise you can just focus looking through the viewfinder.
You should probably change the AF mode and AF area.
These are two common concepts in Nikon's ecosystem which I'll try to explain.
AF mode (AF-C, AF-S and AF-A on most cameras or only the first two on higher end ones) dictates when the camera confirms and locks focus.
- AF-C (auto focus continuous) means that the camera will continuously focus as long as you have focus initiated (by having the shutter button pressed halfway, the AF-ON pressed if there is one or the AE-L/AF-L pressed if it's set to function as AF-ON)
- AF-S (auto focus single): the camera will acquire focus once and will keep it locked as long as the shutter button is half pressed (or will keep it where it is if focus is decoupled from the shutter button half-press - see "back button AF" below)
- AF-A (auto focus - auto): the camera will try to decide if the subject is static or moving and will internally choose AF-C or AF-S; it is omitted from higher end cameras since it's assumed that the user will know when to use AF-C and AF-S and since there are dedicated buttons to change it on the fly without looking at the display
AF area dictates which viewfinder AF points the camera will use to acquire focus. There are multiple, but the most important two (for this question) are the following:
- Auto: the camera will look at all the AF points and focus on the closest subject it finds amongst them
- Single (usually denoted by "S"): you choose a single point and the camera uses only it to focus (you can select the active focus point with the directional pad; on D3*** bodies it will most probably blink in red to tell you which one is active since all the points are visible at once and on higher end models it will only show you the active point)
You can read more about back button AF in multiple questions here.
The issue lies most probably in that the camera is set to Auto area and since it finds the trees as the closest subject to you, it sets the focus there. To change it, hit the i button (bottom left next to the display) to bring on the info screen and select the second item on the last row - look for "S" and select it; back to the info screen, the first item on the last row should be AF mode. If AF-A is selected, you may want to change it to AF-C if you want to track moving subjects or to AF-S if you want to shoot something that's not moving. If you're not sure yet, keep it at AF-A. More info on page 74 and on in the manual.
After setting the camera that way, bring the viewfinder to your eye, half press the shutter (to make sure that the metering is active) and use the directional pad to select a focus point (the centre button should select the centre AF point). In the case you described, you should be able to select a focus point that points to the background and the camera will focus there. Be aware that if you're for example taking a picture of two people, you must select one of the side AF points (the centre ones will most probably fall on the background). Be also aware that the camera's AF modules are usually larger than the little squares that are displayed in the viewfinder and thus the camera may still focus to the foreground when you think you've pointed it to the background (or vice versa).
I would do focus & recompose, meaning I focus first where I'd like it to focus, keep the shutter button halfway down and then recompose to my liking. It won't be focused as accurately (you move the camera while recomposing) but you probably are fine focusing at distance as the depth of field should be sufficient.
You may run into issues with the camera's exposure analysis, possibly with white balance. It is often locked down when you focus and now if your recomposed picture would require different exposure, you could run into issues. Take a few shots and adjust if necessary.
Manual focus, cameras are getting good but they don't read minds yet. Cannon lenses can be manually focused even if on AF, likely Nikon is the same. They engineer in the fact that people don't look at an AF-M switch before grabbing the lens.