Answer the question
In order to leave comments, you need to log in
Java how to make each character + 1?
Hello. How can I make each character be + 1 for example:
float pp; //изменяется
//и мне нужно чтобы когда pp = 1; то yy +1 . pp = 2; то yy +1
float yy;
//я не хачу делать так 180 раз
if(pp == 1){
yy = yy + 1;
}
// а хочу упрастить
Answer the question
In order to leave comments, you need to log in
If I understand correctly, then you need to increase yy by 1 every time pp changes? Those. it is trite to count how many times the pp variable has changed.
In this case, you can do this: wrap both variables in a class, and work with them only through getters and setters. There is a direct setter only for pp; inside it, yy is updated according to the rules you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question