TOKYO - Japan enacted a law Wednesday to introduce flexible working hours for public school teachers and limit their monthly overtime to 45 hours, after their tendency to overwork drew public attention.