How is obsidian and coal rock alike?

Obsidian and coal are both rocks and they are formed by lava