A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

事先说下,我是小白,在看基础视频,按照笔记敲的时候出现这个问题,可能对你们来说很简单,但我确实不会,请各位帮忙指教下问题所在。。。

class Function1Demo
{

        public static void draw(int row, int col)

        {
        for(int x = 1;x <= row;x++);
        {
                for(int y = 1;y <= col;y++)

                System.out.print("*");

        }
                System.out.println();


        }

}

3 个回复

倒序浏览
DOS提示没有main函数所在,但是我按照比较敲的   就是不知道main应该敲在什么位置 求大神指教
回复 使用道具 举报
自己解决了,在仔细查看DOS提示错误后,修改过来了
class Function1Demo                                                                                                                               
{
        public static void main(String[] args)
        {       
                int row = 5;
               
                int col = 10;

       
                for(int x = 1;x <= row;x++)

                {
                        for(int y = 1;y <= col;y++)
                        {
                                System.out.print("*");
                    }

                                System.out.println();
                }

        }
       
}
回复 使用道具 举报
没有主函数 程序是运行不起来的,主函数是jvm虚拟机的入口!
回复 使用道具 举报 1 0
您需要登录后才可以回帖 登录 | 加入黑马