Linked Questions
15 questions linked to/from What are "connecting characters" in Java identifiers?
-8 votes
1 answer
249 views
Is int π; is valid syntax in java? [duplicate]
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
-2 votes
1 answer
111 views
Can I use single quotations in an object name? [duplicate]
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 ...
79 votes
8 answers
172k views
Valid characters in a Java class name
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)?
14 votes
3 answers
16k views
Naming restrictions of variables in java
Why are special characters (except $, _) not allowed in Java variable names?
15 votes
2 answers
13k views
How to validate if a string would be a valid java variable?
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 ...
15 votes
3 answers
27k views
What are the valid characters for a Java method name?
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 $...
6 votes
2 answers
1k views
Why does the JVM allow us to name a function starting with a digit in bytecode?
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 ...
-3 votes
2 answers
17k views
Which of these are valid variable names?
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? ...
-3 votes
10 answers
7k views
Using a dot in a string name
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 = ...
2 votes
3 answers
211 views
regex exclude a character not work
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 ...
0 votes
5 answers
2k views
For what is the symbol $ after a variable in Java?
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, ...
1 vote
2 answers
1k views
In Java compiler,which type can be defined as identifier ( ID ) or Keyword (reserved word)?
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, ...
1 vote
2 answers
190 views
What else are permitted extraordinary java method names?
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 ...
1 vote
2 answers
618 views
java valid identifier from java language specification
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), ...
1 vote
1 answer
227 views
Can Enums in Java have names with inequality signs?
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 ...