gpt4 book ai didi

c# - 程序不包含适用于入口点 : i have tries even removing access modifier before static 的静态 'main' 方法

转载 作者:行者123 更新时间:2023-11-30 19:36:47 28 4
gpt4 key购买 nike

using System;

namespace inheritance1
{
public class Employee
{
public string FirstName;
public string LastName;
public string Email;

public void PrintFullName()
{
Console.WriteLine(FirstName + " " + LastName);
}

}
public class FullTimeEmployee : Employee
{
public float YearlySalary;
}
public class PartTimeEmployee : Employee
{
public float HourlyRate;
}
public class Program
{
public static void main(String[] args)
{
FullTimeEmployee FTE = new FullTimeEmployee();
FTE.FirstName = "Max";
FTE.LastName = "Striker";
FTE.YearlySalary = 500000;
FTE.PrintFullName();

PartTimeEmployee PTE = new PartTimeEmployee();
PTE.FirstName = "king";
PTE.LastName = "Maker";
PTE.HourlyRate = 500;
PTE.PrintFullName();
}
}
}

最佳答案

Main 是大写的M,不是main

public static void Main(String[] args)
{

Main () and Other Methods (C# vs Java)

Every C# application must contain a single Main method specifying where program execution is to begin. In C#, Main is capitalized, while Java uses lowercase main.

关于c# - 程序不包含适用于入口点 : i have tries even removing access modifier before static 的静态 'main' 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42536660/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com