My code is always printing Lion | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

My code is always printing Lion

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String input = sc.nextLine(); String [] x = input.split(" "); for (int i=0;i<x.length;++i){ System.out.print(x[i]); if (x[i]=="Rawr"){ System.out.print("Tiger "); } else if(x[i]=="Chirp"){ System.out.print("Bird "); } else if(x[i]=="Ssss"){ System.out.print("Snake "); } else{ System.out.print("Lion "); } } } }

3rd Jul 2020, 10:34 AM
Shivam Rawal
2 Answers
+ 3
https://www.sololearn.com/Discuss/2371797/?ref=app same problem as yours, ypu should check it out
3rd Jul 2020, 10:49 AM
Taste
Taste - avatar
+ 1
Tysm
3rd Jul 2020, 10:51 AM
Shivam Rawal