The period is set in a lease contract.
Most foreigners believe that the lease contract cannot be cancelled during the period which is sent by the term of a contract. That is, most foreigners think they must pay the monthly rent until the expiry of their contract.
In general Japanese lease contact for residences set the lease term as two years. However in fact tenants can cancel a lease contract anytime even during the execution of a contract. Tenants must notify the cancellation to the owner one month in advance. Then tenants can terminate their payment of the monthly rent anytime.
Nevertheless a real estate agent in Kobe who is dealing with foreign expats explain to its foreign customers that Japanese lease contract cannot be cancelled during the period of the lease contract. Since foreign expats are hard to find out Japanese laws, foreign customers believe that they must keep their lease contract until the end of the lease.
It is crooked means that the real estate agent makes foreign tenants not to leave their property, but there still are foul play by Japanese real estate agent for many years.
Any Japanese lawyer or realtor easily understands this legal sense. So please be careful with an underhanded real estate agent and ask someone with experience in real estate business.