This is the way we write the demo,

java2s.com