SlideShare a Scribd company logo
Assignment
HCI
Topic:
User Interaction
Submitted to;
Sir Rehan Faheem
Submitted By;
Muhammad Jamil
Roll No.
BCS(M)-14-57
BZU Sub Campus Sahiwal
OCTOBER 7, 2016
Task: File Handling in Java
Coding:
import java.io.*;
public class WriteAndRead {
public static void main(String [] args) {
try {
FileOutputStream myStream = new FileOutputStream("jamil.txt");
PrintWriter myWriter = new PrintWriter(myStream);
myWriter.println("My name is Jameel");
myWriter.println("Here is my text file");
myWriter.println("Happy Programming");
myWriter.close();
}
catch(Exception e) {
System.out.println(e.getMessage());
}
try {
FileReader obj = new FileReader("jamil.txt");
BufferedReader obj1 = new BufferedReader(obj);
String str = obj1.readLine();
System.out.println(str);
str = obj1.readLine();
System.out.println(str);
str = obj1.readLine();
System.out.println(str);
}
catch(IOException e)
{
System.out.println(e.getMessage());
}
}
}
File input output in Java

More Related Content

PPTX
Mastering the MongoDB Javascript Shell
PDF
Mastering the MongoDB Shell
DOCX
java copy file program
PPTX
MongoDB Shell Tips & Tricks
PPTX
Threads and Node.js
PDF
OSMC 2012 | Distributed Monitoring mit NSClient++ by Michael Medin
PPT
New kid on the block node.js
DOC
Qtp compare xml files
Mastering the MongoDB Javascript Shell
Mastering the MongoDB Shell
java copy file program
MongoDB Shell Tips & Tricks
Threads and Node.js
OSMC 2012 | Distributed Monitoring mit NSClient++ by Michael Medin
New kid on the block node.js
Qtp compare xml files

What's hot (19)

PPTX
Secure code 3rd_party_libs
PPT
PPTX
Improving rpc bkp
PPTX
What's new in the MongoDB Java Driver (2.5)?
PDF
Joy of Unix
PPTX
Shell Tips & Tricks
PDF
A promising approach for debugging remote promises
DOCX
Exp 6.3 d-422 (2)
PDF
[PyConTW 2013] doctest
PDF
ODP
Apachecon Eu 2008 Mina
PPTX
ITS World Congress 2014 - Performance Evaluation of Transit Data Formats on a...
PDF
Infinum android talks_10_getting groovy on android
PPTX
Namespace1
PPTX
Unix- the process
PPTX
Automated Slow Query Analysis: Dex the Index Robot
ODP
Gsummit apis-2013
PPTX
Python lec5
Secure code 3rd_party_libs
Improving rpc bkp
What's new in the MongoDB Java Driver (2.5)?
Joy of Unix
Shell Tips & Tricks
A promising approach for debugging remote promises
Exp 6.3 d-422 (2)
[PyConTW 2013] doctest
Apachecon Eu 2008 Mina
ITS World Congress 2014 - Performance Evaluation of Transit Data Formats on a...
Infinum android talks_10_getting groovy on android
Namespace1
Unix- the process
Automated Slow Query Analysis: Dex the Index Robot
Gsummit apis-2013
Python lec5
Ad

Viewers also liked (17)

PDF
sasasasasasas
PPT
Introduction to objects and inputoutput
PDF
My History
PPT
Threads in Java
PDF
java-thread
PPTX
Java Thread & Multithreading
PPT
java threads
PDF
Input File dalam C++
PPTX
Java - Processing input and output
PPT
Threads in java
PDF
Programming with Threads in Java
PPTX
Java Input Output (java.io.*)
PDF
PPTX
basics of file handling
PPTX
PPT
Java multi threading
sasasasasasas
Introduction to objects and inputoutput
My History
Threads in Java
java-thread
Java Thread & Multithreading
java threads
Input File dalam C++
Java - Processing input and output
Threads in java
Programming with Threads in Java
Java Input Output (java.io.*)
basics of file handling
Java multi threading
Ad

Similar to File input output in Java (20)

DOCX
DOCX
Code red SUM
PDF
Application-Specific Models and Pointcuts using a Logic Meta Language
PPSX
PPTX
Session 23 - JDBC
PDF
DOCX
• GUI design using drag and drop feature of IDE(Net beans), • File IO
PPT
Oop lecture9 12
PPT
Java IO Streams V4
DOC
Inheritance
PPTX
ExtraFileIO.pptx
PDF
Create a text file named lnfo.txt. Enter the following informatio.pdf
PDF
Active Software Documentation using Soul and IntensiVE
PPTX
Understanding java streams
PPTX
File Handling.pptx
PDF
Please include comments if at all possible Use a socket connection t.pdf
PPTX
Session 4 Try with Resources and Custom Exception.pptx
PDF
5. Ввод-вывод, доступ к файловой системе
PDF
Java I/o streams
Code red SUM
Application-Specific Models and Pointcuts using a Logic Meta Language
Session 23 - JDBC
• GUI design using drag and drop feature of IDE(Net beans), • File IO
Oop lecture9 12
Java IO Streams V4
Inheritance
ExtraFileIO.pptx
Create a text file named lnfo.txt. Enter the following informatio.pdf
Active Software Documentation using Soul and IntensiVE
Understanding java streams
File Handling.pptx
Please include comments if at all possible Use a socket connection t.pdf
Session 4 Try with Resources and Custom Exception.pptx
5. Ввод-вывод, доступ к файловой системе
Java I/o streams

Recently uploaded (20)

PDF
Nekopoi APK 2025 free lastest update
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PDF
Complete Guide to Website Development in Malaysia for SMEs
PPTX
Patient Appointment Booking in Odoo with online payment
PPTX
history of c programming in notes for students .pptx
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
medical staffing services at VALiNTRY
PPTX
assetexplorer- product-overview - presentation
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
Nekopoi APK 2025 free lastest update
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Salesforce Agentforce AI Implementation.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Design an Analysis of Algorithms I-SECS-1021-03
Monitoring Stack: Grafana, Loki & Promtail
Computer Software and OS of computer science of grade 11.pptx
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
Complete Guide to Website Development in Malaysia for SMEs
Patient Appointment Booking in Odoo with online payment
history of c programming in notes for students .pptx
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
medical staffing services at VALiNTRY
assetexplorer- product-overview - presentation
How to Choose the Right IT Partner for Your Business in Malaysia
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
wealthsignaloriginal-com-DS-text-... (1).pdf
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free

File input output in Java

  • 1. Assignment HCI Topic: User Interaction Submitted to; Sir Rehan Faheem Submitted By; Muhammad Jamil Roll No. BCS(M)-14-57 BZU Sub Campus Sahiwal OCTOBER 7, 2016
  • 2. Task: File Handling in Java Coding: import java.io.*; public class WriteAndRead { public static void main(String [] args) { try { FileOutputStream myStream = new FileOutputStream("jamil.txt"); PrintWriter myWriter = new PrintWriter(myStream); myWriter.println("My name is Jameel"); myWriter.println("Here is my text file"); myWriter.println("Happy Programming"); myWriter.close(); } catch(Exception e) { System.out.println(e.getMessage()); } try { FileReader obj = new FileReader("jamil.txt"); BufferedReader obj1 = new BufferedReader(obj); String str = obj1.readLine(); System.out.println(str); str = obj1.readLine(); System.out.println(str); str = obj1.readLine(); System.out.println(str); }