0
C# problem
What is wrong with this code,it says that a sign is expected in line 25: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Car { string color; string model; public void Fullthrottle() { Console.WriteLine("car is fast"); } } static void Main(string[] args) { Car myObj = new Car(); myObj.Fullthrottle(); } } }
7 Answers
+ 3
Erfan Mostafavi
Just remove the curly, which closes the class to soon. That's why you get this message.
Please remove unecessary tags: c, c++, java
Your problem is only c# related so you should only use this as tag. Thank you.
+ 7
Erfan Mostafavi paste this and see if it works or not,maybe now it's overcome your problem.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SoloLearn
{
class Car
{
string color;
string model;
public void Fullthrottle()
{
Console.WriteLine("car is fast");
}
static void Main(string[] args)
{
Car myObj = new Car();
myObj.Fullthrottle();
}
}
}
+ 4
Erfan Mostafavi It's nothing more than a misplaced extra curly brace in line 22.
+ 1
Thank you Denis,i tagged them because those who have experience in java and c++ can fix this problem too.
+ 1
Erfan Mostafavi
Thank you.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SoloLearn
{
class Car
{
string color;
string model;
public void Fullthrottle()
{
Console.WriteLine("car is fast");
}
}//closes the class here
static void Main(string[] args)
{
Car myObj = new Car();
myObj.Fullthrottle();
}
}//class should be closed here
}
0
So how should i fix that,it won't get fixed
0
Yes man it worked,thanks,would you tell me which curly brace wasn't in its proper place?