public void testForeach(){
System.out.println("有如下课程可选:(通过for each方法)");
for(Object obj:coursesToSelect){ //这行提示Line breakpoint:ListTest [line: 82] - testForeach()
Course cr = (Course)obj;
System.out.println("课程:"+cr.getId()+":"+cr.getName());
Line breakpoint:ListTest [line: 82] - testForeach()这个是什么意思?求详细解答最好带上例子。
public void testForeach(){ System.out.println("有如下课程可选:(通过for each方法)"); Course cr; for(Object obj:coursesToSelect){ cr = (Course)obj; System.out.println("课程:"+cr.getId()+":"+cr.getName()); } }
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
逻辑错误!你循环重复定义cr对象!能不错吗?