How do I operate 2 values, both of different classes in a separate class in java? [closed]

0

good evening I want to know How to operate 2 values, both of different classes in a separate class in java? since I seek to operate (compare, add, subtract, divide, etc) two integer values entered by keyboard; I have these attributes converted into objects but I have no clear logic to apply to operate between objects, thank you very much in advance for answering

    
asked by pangloss 07.11.2017 в 19:44
source

1 answer

1

I think you do not need 2 objects for that, but answering what you want, Suppose you have Object A and Object B

public class Objeto A {

int numero A ; 

}

public class Objeto B {
int numero B 
}

assuming you got the get and seters, then operate only need to do

  

int result = B.getNumberB + A.getNumeroA;

and so the operation you want

    
answered by 07.11.2017 / 19:47
source