Questions tagged as 'comparaciones'

7
answers

Differences between == and === (comparisons in JavaScript)

I've always seen that in JavaScript there is: assignments = comparisons == and === I think I understand that == does something similar to compare the value of the variable and the === also compa...
asked by 03.12.2015 / 10:45
1
answer

How to compare with equals a question with 2 possible answers

I'm doing an exercise in java and I have to compare the answer entered:    Do you want to continue? s / n: You must contemplate both s and S How do I do it? I can only do it with an answer     
asked by 14.07.2017 / 13:40
1
answer

Because the syntax to indicate that a parameter of a generic class is comparable is T extends ComparableT?

I've been looking at different posts about the same question but I do not understand why in the syntax <T extends Comparable<T>> you put the word extends and not the word implements , if Comparable is an in...
asked by 31.10.2018 / 00:03
12
answers

How to correctly compare Strings (and objects) in Java?

I am creating a mini game in which the user tries to guess a name. But when I want to compare two text strings to see if they are equal it does not seem to work. final String miNombre = "Jordi"; Scanner input = new Scanner(System.in); System.o...
asked by 02.12.2015 / 13:35
1
answer

Java doubt: .Equals ()

At work I'm using Java and I have to use the equals () function frequently. My question is what is the difference between !"".equals(objeto); in front of !objeto.equals(""); At work they force me to use the first, but I do not under...
asked by 09.07.2018 / 13:04
4
answers

It does not compare well the string (I think). Java CompareTo ()

Well, I have a problem and I do not understand why it does not compare well the value of the string. I would appreciate all the help possible. By not sharing well the "numbers" (passed as string). the final string is larger than a long and gives...
asked by 24.11.2017 / 13:50
12
answers

How to correctly compare Strings (and objects) in Java?

I am creating a mini game in which the user tries to guess a name. But when I want to compare two text strings to see if they are equal it does not seem to work. final String miNombre = "Jordi"; Scanner input = new Scanner(System.in); System.o...
asked by 02.12.2015 / 13:35
0
answers

How to correctly compare the getPassword method of a jPasswordField [closed]

Good afternoon, It turns out that today I was doing a login form with java for the first time. To recover the password I was going to use the getText () method, but I have seen that it is in disuse since it returns a String and that would...
asked by 30.04.2017 / 19:22
3
answers

Problems validating contact form fields

I have a page to contact me and I need all fields filled out. I have to use alert to warn that you have not entered any field and what is that field. I tried to use isNaN but it did not work for me. Also try this but it did not...
asked by 29.06.2017 / 02:38
1
answer

Differences between "foo instanceof Type" and "foo.getClass () == Type.class / fuu.getClass ()"

When determining if an object belongs to a type, basically one of these two solutions is used: foo instanceof Tipo; O foo.getClass() == Tipo.class; The question is: What advantages and disadvantages does each one offer and in which cas...
asked by 30.11.2016 / 13:06