问答详情
源自:4-6 学生选课—课程查询

Line breakpoint问题,第一次遇到

    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()这个是什么意思?求详细解答最好带上例子。

提问者:EKKOY 2017-02-10 09:19

个回答

  • 霸道学长3192921
    2017-02-10 09:43:27
    已采纳

    public void testForeach(){
        System.out.println("有如下课程可选:(通过for each方法)");
        Course cr;
        for(Object obj:coursesToSelect){ 
            cr = (Course)obj;
            System.out.println("课程:"+cr.getId()+":"+cr.getName());
        }
    }


  • qq_慕圣0197102
    2021-03-22 19:00:33

    <%@ 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>


  • 霸道学长3192921
    2017-02-10 09:36:19

    逻辑错误!你循环重复定义cr对象!能不错吗?