<?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>file reader | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/file-reader/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>
		<item>
		<title>Java program to display the information&#8217;s of the file</title>
		<link>https://studentprojects.in/software-development/java/java-programs/basic/java-program-to-display-the-informations-of-the-file/</link>
					<comments>https://studentprojects.in/software-development/java/java-programs/basic/java-program-to-display-the-informations-of-the-file/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 02 Oct 2009 16:19:32 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[file reader]]></category>
		<category><![CDATA[check read write]]></category>
		<category><![CDATA[permissions of file]]></category>
		<category><![CDATA[file programing in java]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=862</guid>

					<description><![CDATA[<p>Write a Java program that reads on file name from the user then displays information about whether the file exists,whether the file is readable,whether the file is writable,the type of the file and the length of the file in bytes</p>
<p>The post <a href="https://studentprojects.in/software-development/java/java-programs/basic/java-program-to-display-the-informations-of-the-file/">Java program to display the information’s of the file</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Write a Java program that reads on file name from the user then displays information about whether the file exists, whether the file is readable, whether the file is writable, the type of the file and the length of the file in bytes</p>
<pre lang="java" escaped="true" line="1">
import java.util.Scanner;
import java.io.File;
class FileDemo
{
	public static void main(String[] args)
	{
		Scanner input=new Scanner(System.in);
		String s=input.nextLine();
		File f1=new File(s);	
		System.out.println("File Name:"+f1.getName());
		System.out.println("Path:"+f1.getPath());
		System.out.println("Abs Path:"+f1.getAbsolutePath());
		System.out.println("Parent:"+f1.getParent());
		System.out.println("This file is:"+(f1.exists()?"Exists":"Does not exists"));
		System.out.println("Is file:"+f1.isFile());
		System.out.println("Is Directory:"+f1.isDirectory());
		System.out.println("Is Readable:"+f1.canRead());
		System.out.println("IS Writable:"+f1.canWrite());
		System.out.println("Is Absolute:"+f1.isAbsolute());
		System.out.println("File Last Modified:"+f1.lastModified());
		System.out.println("File Size:"+f1.length()+"bytes");
		System.out.println("Is Hidden:"+f1.isHidden());
	}
}
</pre>
<p><strong>Output:</strong></p>
<p>Fibonacci.java<br />
File Name:Fibonacci.java<br />
Path: Fibonacci.java<br />
Abs Path: c:\sameer\Fibonacci.java<br />
Parent: Null<br />
This file is:Exists<br />
Is file:true<br />
Is Directory:false<br />
Is Readable:true<br />
Is Writable:true<br />
Is Absolute:false<br />
File Last Modified:1206324301937<br />
File Size: 406 bytes<br />
Is Hidden:false</p><p>The post <a href="https://studentprojects.in/software-development/java/java-programs/basic/java-program-to-display-the-informations-of-the-file/">Java program to display the information’s of the 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-to-display-the-informations-of-the-file/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
