import java.io.*;
class StringContents
{
protected static void main()throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the String: ");
String st=in.readLine();
short u=0,l=0,sp=0;
for(short i=0;i<st.length();i++)
{
char ch=st.charAt(i);
if(ch>=65&&ch<91)
u++;
else if(ch>=97&&ch<123)
l++;
else if(ch==' ')
continue;
else
sp++;
}
System.out.println("No. of lower case characters: "+l);
System.out.println("No. of upper case characters: "+u);
System.out.print("No. of special characters: "+sp);
}}
what is string
i dont no string for servlate
[ string toupper $str ] or [ string tolower $str ]
.... String line = "This is example program with spaces"; String[] tokens = line.split(" "); System.out.println(tokens.length-1); .......
final String[] days = new String[] {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
what is string
i dont no string for servlate
[ string toupper $str ] or [ string tolower $str ]
.... String line = "This is example program with spaces"; String[] tokens = line.split(" "); System.out.println(tokens.length-1); .......
final String[] days = new String[] {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
i am sam
This is an assignment not a question.
what is if(!(str[i]==32))
print c co com comp compu
public class RemoveSpace{ public static void main(String args[]){ String str = "8085"; Sysytem.out.println(str.trim()); } } Get The Desired OutPut....
If you don't need to preserve the first string you could just iterate over the second string and copy each character onto the end of the first string, then return that