Overloaded method to enter string and check 1.letter appear at the start and end,special word 2.two string equal?3.char at n pos | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Overloaded method to enter string and check 1.letter appear at the start and end,special word 2.two string equal?3.char at n pos

I cannot get the output of the second overloaded function. In the main method, i have entered two strings but in the execution it cannot take 2 string as input. If anyone can help me out in this. See to my code and help me find my mistake. https://code.sololearn.com/cZ8owm4YMGKw/?ref=app

28th Sep 2020, 11:52 AM
Sheetal
Sheetal - avatar
5 Answers
0
ch1=in.next().charAt(0); This cause reading stop when space or new line is encountered but nextLine reading this space or newline to next input. So this cause s2 having extra space at start.. Take it like ob.display(s2.substring(1),s3); Or take ch1=in.nextLine().charAt(0);
28th Sep 2020, 1:11 PM
Jayakrishna 🇮🇳
+ 1
Help me out plz!!!!
28th Sep 2020, 11:54 AM
Sheetal
Sheetal - avatar
+ 1
Jayakrishna🇮🇳 In the second function in which two strings are taken as input. It is not taking input two strings and giving output as "The strings are not equal". See to this
28th Sep 2020, 12:35 PM
Sheetal
Sheetal - avatar
+ 1
Jayakrishna🇮🇳 Thanks a lot. I understood.
28th Sep 2020, 1:21 PM
Sheetal
Sheetal - avatar
0
It working fine.. What inputs you are giving..? How?
28th Sep 2020, 12:16 PM
Jayakrishna 🇮🇳