Campbell Ritchie wrote:Have you been taught to make everything static? I hope not;
Campbell Ritchie wrote:There is nothing wrong with helper classes; they are useful things as long as they don't try to abstract instance data away. Helper classes are probably the same as utility classes. Becaus they don't contain any instance data, they usually have all methods static. I shall let you explain, MS, why they should also have a private constructor.
Monica Shiralkar wrote:Something is surely wrong .
Junilu Lacar wrote:
Monica Shiralkar wrote:Something is surely wrong .
The question is, why do you think it's wrong? What principle/concept are you violating? You have to understand why before you can fix the what.
Monica Shiralkar wrote:I am thinking it's wrong because , in Java like everything normal methods too exist for some reason but my way of coding never uses them.
Monica Shiralkar wrote:I think that since normal methods are used for changing the value of the variables of the class.
Monica Shiralkar wrote:Sorry, I meant class members.
Don't use the same object operator == on reference types (line 42)
What happens if the player enters the same digit repeatedly, e.g. 000, 111 100, 666?
Monica Shiralkar wrote:Instance methods are used for modifying the value of the class variables.
Junilu Lacar wrote:
Monica Shiralkar wrote:Instance methods are used for modifying the value of the class variables.
Absolutely not.
Not necessarily. I advise against working out why at this stage of your career, but it is another reason for not using ==.ken luong wrote:. . . s1 = "hi" and s2 = "hi". In this scenario, s1 == s2 would returns false . . .
Do you remember what the official definition of class members is? It's in the Java® Language Specification.Monica Shiralkar wrote:Sorry, I meant class members.
Monica Shiralkar wrote:Instance methods are used for modifying the value of the class variables.
Yeah. What he said. Totally. Wait. What? Sorry, I was looking at this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|