Questions tagged as 'equals'

4
answers

Behavior of the different forms of comparison in Java

If for example I have the code below, I'm comparing the object reference in the ex1 and ex2 case and not the object itself, correct? Pessoa ex1 = new Pessoa(); Pessoa ex2 = new Pessoa(); if(ex1 == ex2) { System.out.println("I...
asked by 01.10.2014 / 19:27
3
answers

Difference of StringBuffer.equals and String.equals in Java

The behavior of method equals of class StringBuffer of Java is different from equals of class String ? If yes, how would I overwrite it?     
asked by 06.11.2014 / 05:18
1
answer

Use of equals and inheritance

I have a parent class and in it I have equals and I have other child classes of this parent class and I want to override equals to compare private attributes of those child classes but I also want to use equals of my father...
asked by 21.11.2014 / 04:36
2
answers

How does the equals method work?

I stopped in an exercise of a book I'm reading and in this shows an example of overloading the equals method, I even understood the concept that it compares the reference between two objects, but in the method: public boolean equals(Ob...
asked by 02.02.2016 / 02:59
1
answer

How to override equals so that it compares: primitive objects and keys (int, String, double)

Can you make the comparison in any way? because in my code, if it is not int or Object the program throws an exception. To be able to use in the method contains the SortSequenceNonOrder class. Person Class public class Pessoa implements Com...
asked by 26.04.2018 / 20:36
2
answers

How to validate an upload by filename?

I'm trying to validate the upload of a file, and it should always be called new.mpg , otherwise the program will not work. function validarNomeArquivo(){ //variavel que recebe o nome do arquivo var oImg = "bgs/newFile.mpg";...
asked by 30.11.2017 / 17:31