Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
I was reading about Java 9 new features, modules and changes. So far so good.
Will Java 9 introduce a standard for code folding?
Something similar to #region in VisualStudio or NetBeans' code folding comments.
[-] // <editor-fold desc="Some description here">
| public void method() {
| doSomething();
| }
_ // </editor-fold>
If not, why?
No, Java 9 will not introduce code folding. The full list of Java 9 features does not mention code folding.
Related
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 yesterday.
Improve this question
I have a java code which has a mapper, reducer, and sum. my current output is : I have a map reduce java code in which I am getting each character from a TEXT file.
The output is correct, something like:
a 4
b 5
c 6
d 6
Now I want to identify in a line that say "language: Engish" or any other language, I need the output to be for all my characteristics like:
English a 4
English b 5
English c 6
English d 6
What approach can I use in my mapper/reducer.
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 5 years ago.
Improve this question
Is it allowed in Java convention to write such code:
public void nameOfTheFunction()
{
}
A lot of people said me that it is prohibited according to Java code convention and that my code should look like:
public void nameOfTheFunction(){
}
But I did not find any info about this.
This is oracle(/java) convention
see oracle
Quote:
Class and Interface Declarations
When coding Java classes and interfaces, the following formatting rules should be followed:
• No space between a method name and the parenthesis “(“ starting its parameter list
• Open brace “{” appears at the end of the same line as the declaration statement
• Closing brace “}” starts a line by itself indented to match its corresponding opening
statement, except when it is a null statement the “}” should appear immediately after the
“{“
class Sample extends Object {
int ivar1;
int ivar2;
Sample(int i, int j) {
ivar1 = i;
ivar2 = j;
}
int emptyMethod() {}
...
}
It's personal preference, plain and simple.
There are many people who tout their preferred style as the "one and only", but in reality it doesn't matter.
This is the Google Java styleguide: Google Java Style Guide
This is the Oracle styleguide: Oracle Java Style Guide
It doesn't really make a difference. You can do what you like the most. In Java however most people write the bracket on the same line as the rest (I personally prefer this as well :)
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
I compiled the following code in java and it compiled!
How?
And when i run it it just runs without any output!
Why did it compile?
public class Check{
public static void main(String args[])
{
for(int i=0;i!=0;i++)
System.out.print(i);
}
}
Indeed the program "does nothing" as far as the user can see. But the instructions(code) you have given to the compiler does in fact have valid statements in it that are syntactically correct. If there are semantic errors in your program, that is up to us as programmers to sort out. This may be considered a bug - but it is one that us, the coders must find and fix - not the compiler.
Hovercraft full of eels' comment on your post explains nicely why there is no output.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Any ideas how to effeciently convert the String "TDMaturityReinvestOnNotSelected" to "TD Maturity Reinvest On Not Selected" using a java function?
Cheers
Shaun
This brilliant answer to RegEx to split camelCase or TitleCase (advanced) should work nicely.
Below is an excerpt from that answer:
final String pattern = "(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])";
for (String w : "TDMaturityReinvestOnNotSelected".split(pattern))
{
System.out.println(w);
}
And the ouput to show it running:
Edit: You'll need to reassemble the split words with spaces, but that should be trivial to work out.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
In java I noticed there are methods associated with conversion of strings and those methods sometimes use the word "parse" in the name of the method. For example the static method,
static int parseInt(String str)
is used to convert a string into int. My question is this. Is "parse" short for another word? Is it just a random word or did it come from somewhere else in some other programming context in Java or anywhere else?
From wikipedia:
Parsing or syntactic analysis is the process of analysing a string of symbols, either in natural language or in computer languages, according to the rules of a formal grammar. The term parsing comes from Latin pars (ōrātiōnis), meaning part (of speech).