All Questions
4 questions
4
votes
3
answers
1k
views
Passing object or using the field
I would like to know what is a more appropriate way to code in Java. Is it generally better to pass entire objects in the method's parameters or just using the fields from the class?
Using the field:
...
0
votes
1
answer
267
views
Which is better in terms of performance (bool01==bool02) vs (bool01 && bool02) [duplicate]
Which of these two is the better way of doing the same thing -
public void someMethod(String s, boolean bool02){
boolean bool01 = s!=null;
if(bool01==bool02){
doSomething();
}
}
OR
public void ...
3
votes
3
answers
6k
views
articles in variable names and hard-coding strings
re-edited by author: no this is not 2 questions. This is one question about code review questions containing two separate points. Please do not edit my question.
For naming variables, the two sides ...
11
votes
3
answers
12k
views
When comparing a string variable to a string literal with .equals(), is there a standard practice for the order of items? [closed]
There are benefits to each and I understand the differences, but what is considered best / standard practice? And why?
For example :
"myString".equals(myStringVar)
Avoids a potential NPE and does ...