选择不包含主要类型

编程入门 行业动态 更新时间:2024-10-27 19:26:53
本文介绍了选择不包含主要类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我将其作为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

更多推荐

选择不包含主要类型

本文发布于:2023-11-15 17:22:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1596454.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不包含   类型

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!