i am new to programming skills it may be silly question for experience but for me it's new thing. actually i tried a lot but i am facing problem when i trying to take input through Scanner.
if i will take input a sentence directly as a string it's working . but when i am trying with Scanner the first word is showing next are not showing
public class Demo2
{
public static void main(String[] args)
{
String s1="hi how are you";
s1=s1.replace('a', 'A');
s1 =s1.replace('e', 'E');
s1 =s1.replace('i', 'I');
s1 =s1.replace('o', 'O');
s1 =s1.replace('u', 'U');
System.out.println(s1);
}
}
O/P--hI hOw ArE yOU
this is working properly.
but when i trying with Scanner i am facing problem.
public class Demo2
{
public static void main(String[] args)
{
java.util.Scanner scn= new java.util.Scanner(System.in)
String s1=scn.next();
s1=s1.replace('a', 'A');
s1 =s1.replace('e', 'E');
s1 =s1.replace('i', 'I');
s1 =s1.replace('o', 'O');
s1 =s1.replace('u', 'U');
System.out.println(s1);
}
}
o/p-- hI