Linked Questions

-8 votes
1 answer
249 views

I have some doubt ,i want to know that is int π; is a valid syntax in Java Or Not because Java support UNICODE so according to me it can be valid but I want to make sure
user2134725's user avatar
-2 votes
1 answer
111 views

I need to name an Object: Dave's Account I'm trying to do this using the following code: Account Dave's Account = new Account; but it's not working, I need the single quotation to be part of the ...
Ziad's user avatar
  • 103
79 votes
8 answers
172k views

What characters are valid in a Java class name? What other rules govern Java class names (for instance, Java class names cannot begin with a number)?
Zach's user avatar
  • 2,155
14 votes
3 answers
16k views

Why are special characters (except $, _) not allowed in Java variable names?
NPKR's user avatar
  • 5,516
15 votes
2 answers
13k views

How can I best check if a string input would be a valid java variable for coding? I'm sure I'm not the first one who is willing to do this. But maybe I'm missing the right keyword to find something ...
membersound's user avatar
  • 87.9k
15 votes
3 answers
27k views

I read about the naming of Java variables. It says that Java variables cannot start with any numbers and special characters except for $ and _. Some valid examples: int count; int _count; int $...
kon's user avatar
  • 4,324
6 votes
2 answers
1k views

Identifiers are well defined by The Java Language Specification, Java SE 7 Edition (§3.8) An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a ...
Pier-Alexandre Bouchard's user avatar
-3 votes
2 answers
17k views

This is a question from a Java test I took at University I. publicProtected II. $_ III. _identi#ficador I've. Protected I'd say I, II, and I've are correct. What is the correct answer for this? ...
Vilches Felipe's user avatar
-3 votes
10 answers
7k views

The following line of code will not compile: String 89.9 = new String("Hot 89.9"); It gives the following errors: src/mainPackage/Userinterface.java:73: error: ';' expected String Hot89.9 = ...
jarpoole's user avatar
2 votes
3 answers
211 views

i want to get class name from java file .for example class Mango { now i want to get mango as class name. this is the regex i used \s*class\s+(\S+) it works and i captured the class name .the ...
while true's user avatar
0 votes
5 answers
2k views

I was reviewing a program I found in internet and I'm trying to figure out how it works, but I can't find anything about this function that could help me. public static double regress(double x, ...
yamilelias's user avatar
1 vote
2 answers
1k views

I have a simple question: In Java Compiler, Which type of method or variables can be defined as identifier (ID) or Keyword (reserved word)? For following example, ID should be : add, main, a, b, c, ...
user2871337's user avatar
1 vote
2 answers
190 views

I know $ can be used as a method name in Java. What else? class MyClass { String $() { return "I've never been expected anyone would invoke me"; } } This is actually a practical ...
Jin Kwon's user avatar
  • 22.4k
1 vote
2 answers
618 views

Many places on SO lead to the JLS section on Identifiers, but I have a question on what's written there. The "Java letters" include uppercase and lowercase ASCII Latin letters A-Z (\u0041-\u005a), ...
lf215's user avatar
  • 1,201
1 vote
1 answer
227 views

I'm new to Java and trying to setup a switch statement using enums. for the declaration of my enums however I am getting compilation errors such as "illegal start of type", so my question is if names ...
user1623990's user avatar