Hiw to solve this problem? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hiw to solve this problem?

Private string name; (show error about illegal start of expression) ...

17th Feb 2022, 3:09 PM
lr oi
5 Answers
+ 1
private String name; // capital S , small p Show the full code, if not work..
17th Feb 2022, 3:23 PM
Jayakrishna 🇮🇳
+ 1
lr oi private, public, protected are keywords which should be in small letter String is a class which should start from Capital letter because classes start from Capital letter name is a variable which should follow camelCase rules means if there are more than two words in a variable then variable name should be camelCase So here: private String name;
17th Feb 2022, 6:01 PM
A͢J
A͢J - avatar
+ 1
Manav Roy You cannot use public, private, protected inside method. It should be inside class
17th Feb 2022, 10:23 PM
A͢J
A͢J - avatar
+ 1
Manav Roy Yes because variable inside method is not accessible outside the method means it is local to the method so doesn't make sense to use access modifiers.
18th Feb 2022, 7:02 AM
A͢J
A͢J - avatar
0
Manav Roy May you missing any braces or wrong syntax. Only on seeing code, I can tell mistake if any. So only it's a guess now..
17th Feb 2022, 6:34 PM
Jayakrishna 🇮🇳