本文介绍了选择不包含主要类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我将其作为Java应用程序运行时,它会显示警告选择不包含主类型".有人可以告诉我怎么了吗?并在错误不再出现后看起来会运行吗?
When I run this on as a Java application it comes up with the warning "Selection does not contain a main type". Can someone tell me what''s wrong? And does it look like it would run after the error no longer appears?
package com.ajaxwoot; public class Camcorder { int recTime; boolean canRecord = true; public void record(){ if (canRecord = true){ System.out.println("I''m recording this now."); } recTime = 1; while (recTime < 20){ System.out.println("In the process of recording. Time left: " + recTime++); } } }推荐答案
这是完整的代码吗? 然后,您缺少了main方法,该方法是您编码的入口点: This is the complete code right? Then you''re missing the main method, which is needed as the entry point to your coding: public class Camcorder{ public static void main(String[] args) { Camcorder oComcorder = new Camcorder(); Camcorder.record(); } // rest of your code goes here
您还应该阅读这里以了解它的含义: 设置应用程序的入口点 [ ^ ] @ Java教程
you should also read here to understand what it is about: Setting an Application''s Entry Point[^] @ Java Tutorials
更多推荐
选择不包含主要类型
发布评论