To advance Java programming educations, we have developed a Web-based Java Programming Learning Assistant System (JPLAS). JPLAS offers several types of programming exercises to cover various learning stages of Java programming, where any answer can be marked automatically on the server. The code writing problem requests a student to write a source code satisfying the specifications described in the test code, such as names and data types of classes, methods, and variables, so that the answer code is marked by running the test code on JUnit. However, it appears challenging for a novice student to extract the specifications from the test code properly. In this paper, we propose a code correction problem as a new type programming exercise for reading and debugging codes, which gives a source code with errors called a problem code with the corresponding test code, and requests students to correct the problem code to pass the test code. We also propose the error generation algorithm to generate the problem code from a sample source code automatically. We verify the effectiveness of our proposal through applications of seven assignments of the code correction problem to 45 students in the Java programing class in Okayama University.