//GradeName.class
import java.util.Scanner;
public class GradeBook
{
private String courseName;
public GradeBook(String name)
{
courseName=name;
}
public void setCourseName(String name)
{
courseName=name;
}
public String getCourseName()
{
return courseName;
}
public void displayMessage()
{
System.out.printf("Welcome to the grade book for \n%s!\n\n", getCourseName());
}
public void determineClassAverage()
{
Scanner input=new Scanner(System.in);
int total;
int gradeCounter;
int grade;
int average;
total=0;
gradeCounter=1;
while(gradeCounter<=10)
{
System.out.print("Enter a grade : ");
grade=input.nextInt();
total=total+grade;
gradeCounter=gradeCounter+1;
}
average=total/10;
System.out.printf("\n Total of all 10 grades is %d\n", total);
System.out.printf("Class average is %d\n", average);
}
}
//GradeNameTest.class
public class GradeBookTest
{
public static void main(String args[])
{
GradeBook myGradeBook=new GradeBook("CS101 Introduction to Java Programming");
myGradeBook.displayMessage();
myGradeBook.determineClassAverage();
}
}
整个程序运行时正确的,但是我想看里面每一行程序的调用,当我进行debug时,出现下面错误
Source not found.
由于是新手,希望大神能够帮忙解决。。万分感谢。。。
------解决方案--------------------
加断点了??
------解决方案--------------------
1.Window --> Preferences --> Tomcat --> Source Path,在Source Path 标签下有行文字:Add java projects to source path(Eclipse debugger will search for source files in these projects),将要调试的project选中;