//please save this code as Cap.java or download the given file and compile it with " javac Cap.java " //After successful compilation run this with " java Cap" at CMD // Make sure you have java already //installed in your system CODE : : import java.util.*; class Cap { public static void main(String m[]) { Scanner in=new Scanner(System.in); String s=new String(); System.out.println("Enter a line:"); s=in.nextLine(); char c; int ct=0; for(int i=0;i<s.length();i++) { c=s.charAt(i); if(c>=65 && c<=90) { ct++; } } System.out.println("total number of words start with capital letters are :"+ct); } } OUTPUT : :
Niranjan
27/7/2015 02:37:51 pm
it only count no. Of capital letter not word try this line
Reply
27/7/2015 03:06:08 pm
yea , i know it . the sentence you wrote is in camel case
Reply
Chintan Rajpara
21/7/2017 05:53:32 pm
HEY TRY THIS IT WILL WORK
Reply
Anu
30/12/2016 07:12:27 pm
public static void sentencesChecker(String essay) {
Reply
Harsh Raj Mishra
9/1/2020 03:21:50 pm
Nice it helped me a lot .
Reply
Your comment will be posted after it is approved.
Leave a Reply. |
Hello friends, i am a CSE student and i am going to upload all the programs of various language which might be in your collage practical list or might help you in performing your practicals in lab. Archives
August 2015
Categories |