- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 3
- Posts with Downvotes
- 3
- Downvoting Members
- 1
4 Posted Topics
Re: package arrayexample1; import java.util.Scanner; public class CountSpaceInString { public static void main(String[]args) { Scanner sc=new Scanner(System.in); System.out.println("enter the string..."); String s1=sc.nextLine(); int l=s1.length(); int count=0; for(int i=0;i<l;i++) { char c=s1.charAt(i); if(c==' ') { System.out.println("spaces are in the position of "+i); System.out.println(count++); } else { System.out.println("no spaces are there"); } } … | |
Re: package arrayexample1; import java.util.Scanner; public class CountingLettersFromString { public static void main(String[]args) { char s2; Scanner sc=new Scanner(System.in); System.out.println("enter a string ...."); int count=0; String s1=sc.nextLine(); int l=s1.length(); for(int i=0;i<l;i++) { s2=s1.charAt(i); if(s2==' '|s2=='A'|s2=='a'|s2=='B'|s2=='b'|s2=='C'|s2=='c'|s2=='D'|s2=='d'|s2=='E'|s2=='e'|s2=='F'|s2=='f'|s2=='G'|s2=='g'|s2=='H'|s2=='h'|s2=='I'|s2=='i'|s2=='J'|s2=='j'|s2=='K'|s2=='k'|s2=='L'|s2=='l'|s2=='M'|s2=='m'|s2=='N'|s2=='n'|s2=='O'|s2=='o'|s2=='P'|s2=='p'|s2=='Q'|s2=='q'|s2=='R'|s2=='r'|s2=='S'|s2=='s'|s2=='T'|s2=='t'|s2=='U'|s2=='u'|s2=='V'|s2=='v'|s2=='W'|s2=='w'|s2=='X'|s2=='x'|s2=='y'|s2=='y'|s2=='Z'|s2=='z') count++; else if(s2=='@'|s2=='#'|s2=='$'|s2=='&'|s2=='!'|s2=='%'|s2==','|s2==':'|s2=='<'|s2=='>'|s2=='?'|s2=='^'|s2=='('|s2==')'|s2=='+'|s2=='-'|s2=='*'|s2=='{'|s2=='}'|s2=='['|s2==']') { System.out.println(s2+"special symbols..."); } else System.out.println(s2+"is a digit"); } System.out.println("total no of letters … | |
Re: package arrayexample1; import java.util.Scanner; public class StringCapitalExample { public static void main(String[]args) { char s2; Scanner sc=new Scanner(System.in); System.out.println("enter the string ...."); String s1=sc.nextLine(); int l=s1.length(); for(int i=0;i<l;i++) { s2=s1.charAt(i); if(s2=='A'|s2=='B'|s2=='C'|s2=='D'|s2=='E'|s2=='F'|s2=='G'|s2=='H'|s2=='I'|s2=='J'|s2=='K'|s2=='L'|s2=='M'|s2=='N'|s2=='O'|s2=='P'|s2=='Q'|s2=='R'|s2=='S'|s2=='T'|s2=='U'|s2=='V'|s2=='W'|s2=='X'|s2=='y'|s2=='Z') System.out.println(s2+"is a capitalletter"); else { if(s2=='0'|s2=='1'|s2=='2'|s2=='3'|s2=='4'|s2=='5'|s2=='6'|s2=='7'|s2=='8'|s2=='9') { System.out.println(s2+"is a digit"); } else { System.out.println(s2+"it is not a capital letter"); … | |
Re: package arrayexample1; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class ReadText { public static void main(String[]args) throws FileNotFoundException, IOException { FileOutputStream fos=new FileOutputStream("D://Malli"); FileInputStream fis=new FileInputStream("c://users//desktop/malli/mallika.txt"); int i; while((i=fis.read())!=-1) fos.write((char)i); } } |
The End.