I am very new to Java and I would like to know how can I compare 2 integers? I know this does the job ... but what about peers? Can this compare 2 integers? (when I say that integers mean "int" and not "Integer"). My code is:
import java.lang.*; import java.util.Scanner; //i read 2 integers the first_int and second_int //Code above if(first_int.equals(second_int)){ //do smth } //Other Code
but for some reason this does not work. I mean, Netbeans gives me an error: "int cannot be dereferenced" Why?
source share