标签: compiler-errors

java中的主要方法错误

class PrintMsg
{
  public static  void main(String a[])
  {
    System.out.print("\n THE IS MAIN BLOCK");
  }
}
Run Code Online (Sandbox Code Playgroud)

上面的代码编译成功但我无法在JVM中执行它.发生此错误:

在类PrintMsg.Main中找不到的主要方法,请将main方法定义为:public static void main(String [] args)

我需要更改什么来修复错误?

java compiler-errors

-6
推荐指数
1
解决办法
1238
查看次数

Java非法启动类型)预期

package tic.tac.toe.menu;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class TicTacToeMenu extends Application {

@Override
public void start(Stage primaryStage) {
    Button start = new Button();
    start.setText("How to Play?");
    start.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            System.out.println("\n"+"The goal of tic-tac-toe is to get 3 of your pieces in a row vertically, horizontally, or diagonally ");
            System.out.println("To play this game click inside a square to put down your piece, you choose to …
Run Code Online (Sandbox Code Playgroud)

java syntax javafx compiler-errors menu

-6
推荐指数
3
解决办法
421
查看次数

什么是C#方式相当于这个for循环?

我是C#的新手,日复一日地学习它的元素,来自C也让我感到困惑,因为像这样的简单for循环会起作用,所以为什么它不能在C#中工作,如果你能详细解释的话(如果可能的话)我会非常感激.

for (int i = 1; i <= 10; i++){

    public void question()
    {
        if (questionNr == 1)
        {
            questionLabel.Text = "What is Chuck's full name?";
            ans1.Text = "Charles Irving Bartowski";
            ans2.Text = "Charles Richard Bartowski";
            ans3.Text = "Charles Luke Bartowski";
            ans4.Text = "Zachary Strahovski";
        }
        else if (questionNr == 2)
        {
            questionLabel.Text = "Who/what is Orion?";
            ans1.Text = "Original name of the Intersect";
            ans2.Text = "Alias of a secret mission";
            ans3.Text = "Morgan's Xbox";
            ans4.Text = "Chuck's father";
        } …
Run Code Online (Sandbox Code Playgroud)

c# loops for-loop compiler-errors

-6
推荐指数
2
解决办法
250
查看次数

计算器程序无法编译

我写了一个实现简单计算器的程序.但是,它没有编译.编译器说有22个错误,我不知道为什么.

期望的行为:

  1. 询问用户所需的操作
  2. 向用户询问参数
  3. 输出结果

具体问题或错误:

在任何发生编译错误cin,cout,endl,casebreak

最小,完整和可验证的示例:

#include <iostream>
int main()
{
    float area, r, l, h, b;
    int choice;
    cout<<"\n area of?";
    cout<<"\n[1]square \n[2]rectangle \n[3]circle \n[4]triangle"<<endl;
    cin>>choice;
    switch(choice);
    {
    case 1:
        cout<<"enter length"<<endl;
        cin>>l;
        area=l*l;
        cout<<area<<endl;
        break;
    case 2:
        cout<<"enter height"<<endl;
        cin>>h;
        cout<<"enter length"<<endl;
        cin>>l;
        area=l*h;
        cout<<area<<endl;
        break;
    case 3:
        cout<<"enter radius"<<endl;
        cin>>r;
        area=r*r*3.14;
        cout<<area<<endl;
        break;
    case 4:
        cout<<"enter height"<<endl;
        cin>>h;
        cout<<"enter breadth"<<endl;
        cin>>b;
        area=h*b*0.5;
        cout<<area<<endl;
        break;
    }

    return …
Run Code Online (Sandbox Code Playgroud)

c++ compiler-errors switch-statement

-7
推荐指数
1
解决办法
79
查看次数

为什么表达式'a ++ + = b'会出错?

#include <iostream.h>
int main()
{
  int a = 2;
  int b = 3;
  a++ += b;
  std::cout << a;
}
Run Code Online (Sandbox Code Playgroud)

我对此的理解是,这个表达式首先评估a + b,将该值存储在a中然后递增它.这里发生了什么?

c++ compiler-errors syntax-error

-8
推荐指数
1
解决办法
131
查看次数

Why won't clang compile this source code that works in VS2012?

I don't know if I'm doing something wrong here, but I can't for the life of me get clang to compile existing code that compiles fine in VS2012.

Includes like strsafe.h and xstring cause weird compilation errors, the strangest of which is a "missing close bracket" in the middle of a standard include file. Needless to say, there is no missing bracket. Further, move.h causes clang to throw up with

fatal error: expected function body after function declarator.

Guard …

c++ compiler-errors clang

-46
推荐指数
2
解决办法
1944
查看次数