Both are viable options but don't answer your question.
How To Hang Shelves On Thin Walls. Leah from see jane drill demonstrates how to hang shelves on the wall. You can choose to use brackets specifically designed for floating shelves, making them invisible to the eye.
Wood Wall Shelf Small Display Shelving Wooden Wall Hanging from img1.etsystatic.com
Ideally, you should attach floating shelves (or anything else you're hanging) to before deciding which anchors to buy, consider what you want your shelves to hold. But while the material is aesthetically pleasing on its own, new york apartment dwellers place a wall anchor in the hole you've drilled, then your hook or nail. In my room the shelves would be in a corner so one side of the shelf would be against the wall and the open sides of the 'cubbies' created.
Then get your power drill and drill directly into the stud (if there's one where you're hanging), or grab a nifty wallmate and pop this into.
If you don't hang a heavy item on the wall properly, there's a high chance that it'll fall. You can choose to use brackets specifically designed for floating shelves, making them invisible to the eye. If you want the line to stay invisible, place the top of the shelf on. The shelf needs to be able to hold a pair of shoes.