Solution:
Hello Gavin,
You’ve asked an interesting but very basic question. No shame! I appreciate your asking. You can solve this problem by using an if-statement in your program. If-else will check your number and then return it as you wanted. Let’s start:
public class NegToPos {
public static void main (String [] args) {
int Num = 0;
if (Num >= 0)
System.out.println("It's a non negative number");
else{
System.out.println("It's a negative nummber; now converting to 1");
Num = 1;
System.out.format("Final: %d", Num);
System.out.println("");
}
}
}
So, this code should convert non-positive numbers to 1. Thanks again. Keep asking.