i\'m learning some Java and decided to do something simple but it keeps returning the wrong value... i don\'t know why i\'m sure there something that my untrained eye isn\'t pic
You condition is wrong use &&
instead of ||
. Because in your condition whenever the first part of the condition is true the condition becomes true.
import java.util.Scanner;
import java.lang.*;
public class HelloWorld{
public static void main(String args[]){
int userlevel = 0;
int userxp=12;
int level1xp=0, level2xp=1, level3xp=10, level4xp=15, level5xp=25;
int level1=1, level2=2, level3=3, level4=4, level5=5;
if (userxp <=level1xp){
userlevel=1;
}else if (userxp >=level1xp && userxp = level3xp && userxp =level3xp && userxp