Why String method substring() is not in camelCase in Java? [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
As per Java's standard we should follow CamelCase. But why String's method substring() is not in camelCase ? Is it for any specific reason or just an mistake from the initial days ?

I'd say because substring is one physical word.

camelCase is used to separate words, substring is not to be intended as Sub String but as Substring... so the convention is respected.

Related

Naming conventions for constants in Java [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
When a constant variable ends with a number, do you need to put an underscore in between the number and the rest of the variable?
I haven't found a Java naming convention for this case.
For example YELLOW3 or YELLOW_3

Java - Regex only 0 or 5 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Regular expression only accepts 0 or 5.
Is there a regex expression to evaluate that?
Thanks.
You can use either "0|5" or "[05]". The first is an alternative, the second is a character class. They will behave identically. See the documentation for Pattern for more information on the building blocks for regular expressions.
Read this. And use this:
"^[05]$"

Java 7 Underscore Numeric literals [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Why Java 7 include feature of underscore numeric literals why not comma numeric literals?
The "," operator already has meaning, so existing code would change meaning:
// Is this 3 values or 2?
int[] values = { 123,456, 789 };

Changing the Lengths of Words in a String - Java [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am currently writing a game in Java, where words in a string will have to be all changed to equal 5 characters a word.
eg. I am writing in Java
Iamwr iting inJav a
I wonder if anyone knows how I would do this?
First remove spaces between words.
Then split that resulting String to length with 5.
Add a space after every 5 character.

Memory issues with substring [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How does substring method work internally and how can it create memory issue ?
How can we solve it?
Prior to Java 7 udate 6, substring used to return a view on the original string. So imagine you had a String of 1,000,000 characters and called s.substring(0, 1) because you are only interested in the first character, the original string would have stayed in memory.
Since Java 7u6 substring returns a new string which prevents that issue.

Categories

Resources