Television footage showed a wild boar charging around a classroom, bashing its snout against a window in an apparent attempt to escape the school in the western city of Kyoto.
Meanwhile, the other boar was taking a soothing dip in the school's outdoor pool, as stunned pupils looked on.
"I was very surprised to see it," a male pupil told Nippon TV, adding that they moved at "super" speed.
Students were taking mid-term exams when Monday's unwelcome interruption occurred but the exams eventually continued as scheduled, public broadcaster NHK reported.
Wild boars have increasingly been sighted in cities near Japan's mountainous countryside, as observers say over-development has deprived them of their habitat. Click for more trending news