<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>number of lines | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/number-of-lines/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Fri, 02 Oct 2009 18:00:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>Java program that displays the number of characters, lines and words in a text file</title>
		<link>https://studentprojects.in/software-development/java/java-programs/basic/java-program-that-displays-the-number-of-characters-lines-and-words-in-a-text-file/</link>
					<comments>https://studentprojects.in/software-development/java/java-programs/basic/java-program-that-displays-the-number-of-characters-lines-and-words-in-a-text-file/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 02 Oct 2009 18:00:29 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[Java program]]></category>
		<category><![CDATA[file reader]]></category>
		<category><![CDATA[number of lines]]></category>
		<category><![CDATA[word counter in java]]></category>
		<category><![CDATA[line counter]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=867</guid>

					<description><![CDATA[<p>while((c=isr.read())!=-1)<br />
		{<br />
			chars++;<br />
			if(c=='\n')<br />
				lines++;<br />
			if(c=='\t' &#124;&#124; c==' ' &#124;&#124; c=='\n')<br />
				++words;<br />
			if(chars!=0)<br />
				++chars;<br />
		}</p>
<p>The post <a href="https://studentprojects.in/software-development/java/java-programs/basic/java-program-that-displays-the-number-of-characters-lines-and-words-in-a-text-file/">Java program that displays the number of characters, lines and words in a text file</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="java" escaped="true" line="1">
import java.io.*;
class wordcount
{
	public static int words=0;
	public static int lines=0;
	public static int chars=0;
	public static void wc(InputStreamReader isr)throws IOException
	{
		int c=0;
		boolean lastwhite=true;
		while((c=isr.read())!=-1)
		{
			chars++;
			if(c=='\n')
				lines++;
			if(c=='\t' || c==' ' || c=='\n')
				++words;
			if(chars!=0)
				++chars;
		}	
       }
	public static void main(String[] args)
	{
		FileReader fr;
		try
		{
			if(args.length==0)
			{
				wc(new InputStreamReader(System.in));
			}
			else
			{
				for(int i=0;i<args.length;i++)
				{
					fr=new FileReader(args[i]);
					wc(fr);
				}
			}

		}
		catch(IOException ie)
		{
			return;
		}
		System.out.println(lines+" "+words+" "+chars);
	}
}
</pre>
<p>Output:</p>
<p>This is II CSE<br />
1 4 32</p>
<p>Draw the frequency response<br />
1 4 58</p><p>The post <a href="https://studentprojects.in/software-development/java/java-programs/basic/java-program-that-displays-the-number-of-characters-lines-and-words-in-a-text-file/">Java program that displays the number of characters, lines and words in a text file</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/java/java-programs/basic/java-program-that-displays-the-number-of-characters-lines-and-words-in-a-text-file/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
