Skip to main content

All 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: ...
max's user avatar
  • 163
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 ...
user3344591's user avatar
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 ...
Iceberg's user avatar
  • 49
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 ...
BrandonV's user avatar
  • 1,356