Best way for nested comment-blocks [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 4 days ago.
Improve this question
Somethimes I have the problem to set blocks or longer areas of code into a comment but there is already a multiline-comment inside.
/*
foo ();
/* blabla // DOES NOT WORK
blabal
blabla */
bar ();
*/
Having already a /**/ inside of a higher /**/ is not possible.
If the inside comment is longer then replacing it with single-line comments // is also not optimal.
What's the common way of handling this situation??
I face this in Java and C++ sometimes.

Related

I am doing an assignment for my Java class and I am having problems I don't understand what I am expected to put in [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 15 hours ago.
Improve this question
enter image description here
I've tried googling and I have even created a chegg account but I didn't get an explanation or what I was expected to do.
What am I expected to put in the box?
What am I expected to put in the box?

Is it a bad practice to add a listener in a block of code executed multiple times? [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 10 months ago.
Improve this question
I have the following question: let's say I have a function named hi and a button named btn.
What will the following code produce?
fun hi(){
Btn.setOnClickListener { /*something */ }
}
Every time the method is called, the listener is being reset.
This means that there will not be multiple calls once the Btn is clicked.
Usually click listeners are set only one time.
The cost of each call is creating a new instance of OnClickListener

Is it important to use labels 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 7 years ago.
Improve this question
How important is it to use labels in Java? I haven't seen labels used, except in academic books.
I saw them used with jump statements such as break and continue.
You can use labels, but they are considered bad form in general, sort of unrestrained jumping within a method, it makes the code harder to maintain and can introduce bugs if not handled carefully.
As a rule with OO there is usually an easier/better way to achieve things.
In too many years of coding Java I have never used a label.

Vertical Printing pattern in java [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 7 years ago.
Improve this question
I want a program for printing numbers in below format in java.
for(int i=0,r=1;i<h.length/2;) {
//System.out.println(h[i]);
for(int j=i;j<r;j++) {
System.out.print(h[j]);
}
System.out.println("");
r=r+2;
}
The expected output should be
1
24
356
System.out.println("1\n\n24\n\n356");
</sarcasm>
more information is needed (what is your exact problem? what do you want to achieve? input -> outcome)
what have you tried and where exactly are you stuck.
Edit your question and i edit my answer ;)

Is it bad to have if statements without else statements? [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 9 years ago.
Improve this question
I was just curious to know if its a bad thing to have an if(){} construct without an else statement in java.
No of course not. There are several times when you only need an if statement without a corresponding else.

Categories