C# problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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(); } } }

13th Mar 2020, 9:55 PM
Erfan Mostafavi
Erfan Mostafavi - avatar
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.
13th Mar 2020, 10:14 PM
Denise Roßberg
Denise Roßberg - avatar
+ 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(); } } }
13th Mar 2020, 10:07 PM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
+ 4
Erfan Mostafavi It's nothing more than a misplaced extra curly brace in line 22.
13th Mar 2020, 10:02 PM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
+ 1
Thank you Denis,i tagged them because those who have experience in java and c++ can fix this problem too.
13th Mar 2020, 10:14 PM
Erfan Mostafavi
Erfan Mostafavi - avatar
+ 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 }
13th Mar 2020, 10:17 PM
Denise Roßberg
Denise Roßberg - avatar
0
So how should i fix that,it won't get fixed
13th Mar 2020, 10:04 PM
Erfan Mostafavi
Erfan Mostafavi - avatar
0
Yes man it worked,thanks,would you tell me which curly brace wasn't in its proper place?
13th Mar 2020, 10:11 PM
Erfan Mostafavi
Erfan Mostafavi - avatar