In here why java is not taking input From String = sc.nextLine(); It just skip that part and jump directly to if statement
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter value between 1 or 2 : ");
int a = sc.nextInt();
System.out.println("Enter String value : ");
String str = sc.nextLine(); //Java Skips this part
if (a==1){
System.out.println(str + "1");
}
else{
System.out.println(str + "2");
}
}