Serial stops returning data. java.io.IOException: Device not configured in write

I'm (obviously) not super well versed in circuit building, but for creating a hookup that has two closed switches connected to a digital pin that would register when one of the switches opens, would this work ("C" is a switch that is closed):

5V -----C------C-------(10K resistor)----Ground
|
|
digital pin