Ram
Ram

Reputation: 21

Program does not contain a static 'main' method suitable for an entry point : i have tries even removing access modifier before static

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();
        }
    }
}

Upvotes: 2

Views: 97

Answers (1)

Habib
Habib

Reputation: 223187

It is Main with an upper case M, not 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.

Upvotes: 8

Related Questions