SlideShare a Scribd company logo
Discuss the relationship between some of the common file classes in the Java API, the types of
exceptions that can be thrown, and the best ways to handle the possible exceptions.
Solution
Common Files classes in java listed below:
1. Byte Streams class
a. FileInputStrream ---It throws IOException
b.FileOutputStream ---It Throws IOException
2. Character Streams class
a. FileReader ---It Throws IOEception
b. FileWriter ---It throws IOException
3. Buffered Stream
a. BufferedReader ---It Throws IOEception
b. BufferedWriter ---It Throws IOEception
c. BufferedInputStream ---It Throws IOEception
d. BufferedOutputStream ---It Throws IOEception
4. Data Streams
a. DataInputStream ---It Throws IOEception
b.DataOutputStream ---It Throws IOEception
5. Object Stream
a. ObjectInputStream --it throws ClassNotFoundException
b. ObjectOutputStream --it throws ClassNotFoundException
They can also Throw FileNotFoundException
Best solution is use try and catch block for catching exception
If you want to catch any speific exception any you can give specific name in catch block
otherwise you can give Exception.
Ex.
try{
....
//code
}catch(FileNotFoundException exception) {
}catch(IOException exception) {
}catch(Exception exception) {
}
If you do not want to handle the exception then you can thow the exception using throws
keyword
Thanks a lot

More Related Content

Similar to Discuss the relationship between some of the common file classes in .pdf

Input/Output Exploring java.io
Input/Output Exploring java.ioInput/Output Exploring java.io
Input/Output Exploring java.io
NilaNila16
 
Input output files in java
Input output files in javaInput output files in java
Input output files in java
Kavitha713564
 
Java IO
Java IOJava IO
Java IO
UTSAB NEUPANE
 
Java IO, Serialization
Java IO, Serialization Java IO, Serialization
Java IO, Serialization
Hitesh-Java
 
Session 22 - Java IO, Serialization
Session 22 - Java IO, SerializationSession 22 - Java IO, Serialization
Session 22 - Java IO, Serialization
PawanMM
 
Java program file I/O
Java program file I/OJava program file I/O
Java program file I/O
Nem Sothea
 
Unit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptxUnit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptx
DrYogeshDeshmukh1
 
Itp 120 Chapt 19 2009 Binary Input & Output
Itp 120 Chapt 19 2009 Binary Input & OutputItp 120 Chapt 19 2009 Binary Input & Output
Itp 120 Chapt 19 2009 Binary Input & Output
phanleson
 

Similar to Discuss the relationship between some of the common file classes in .pdf (8)

Input/Output Exploring java.io
Input/Output Exploring java.ioInput/Output Exploring java.io
Input/Output Exploring java.io
 
Input output files in java
Input output files in javaInput output files in java
Input output files in java
 
Java IO
Java IOJava IO
Java IO
 
Java IO, Serialization
Java IO, Serialization Java IO, Serialization
Java IO, Serialization
 
Session 22 - Java IO, Serialization
Session 22 - Java IO, SerializationSession 22 - Java IO, Serialization
Session 22 - Java IO, Serialization
 
Java program file I/O
Java program file I/OJava program file I/O
Java program file I/O
 
Unit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptxUnit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptx
 
Itp 120 Chapt 19 2009 Binary Input & Output
Itp 120 Chapt 19 2009 Binary Input & OutputItp 120 Chapt 19 2009 Binary Input & Output
Itp 120 Chapt 19 2009 Binary Input & Output
 

More from arrowcomputers8700

How are control charts madeSolutionThe control chart is a gra.pdf
How are control charts madeSolutionThe control chart is a gra.pdfHow are control charts madeSolutionThe control chart is a gra.pdf
How are control charts madeSolutionThe control chart is a gra.pdf
arrowcomputers8700
 
GENETICS Millie bought three packages of zinnia seeds for red, orang.pdf
GENETICS Millie bought three packages of zinnia seeds for red, orang.pdfGENETICS Millie bought three packages of zinnia seeds for red, orang.pdf
GENETICS Millie bought three packages of zinnia seeds for red, orang.pdf
arrowcomputers8700
 
Figure 5.2 shows a common biological phospholipid called phosphatidy.pdf
Figure 5.2 shows a common biological phospholipid called phosphatidy.pdfFigure 5.2 shows a common biological phospholipid called phosphatidy.pdf
Figure 5.2 shows a common biological phospholipid called phosphatidy.pdf
arrowcomputers8700
 
describe the cell categories of nervous tissue and describe the orga.pdf
describe the cell categories of nervous tissue and describe the orga.pdfdescribe the cell categories of nervous tissue and describe the orga.pdf
describe the cell categories of nervous tissue and describe the orga.pdf
arrowcomputers8700
 
Describe what is meant by the Internet of Things. What industrie.pdf
Describe what is meant by the Internet of Things. What industrie.pdfDescribe what is meant by the Internet of Things. What industrie.pdf
Describe what is meant by the Internet of Things. What industrie.pdf
arrowcomputers8700
 
Create a class named Person. The person class contains first name, .pdf
Create a class named Person. The person class contains first name, .pdfCreate a class named Person. The person class contains first name, .pdf
Create a class named Person. The person class contains first name, .pdf
arrowcomputers8700
 
C++ Programming Language N-number queue rotations.Write methods v.pdf
C++ Programming Language N-number queue rotations.Write methods v.pdfC++ Programming Language N-number queue rotations.Write methods v.pdf
C++ Programming Language N-number queue rotations.Write methods v.pdf
arrowcomputers8700
 
Assume a disease is dominant, indicated by shading. Based on the pedi.pdf
Assume a disease is dominant, indicated by shading. Based on the pedi.pdfAssume a disease is dominant, indicated by shading. Based on the pedi.pdf
Assume a disease is dominant, indicated by shading. Based on the pedi.pdf
arrowcomputers8700
 
Chorismate 3-glycero phosphate Relying on the above pathway for b.pdf
Chorismate 3-glycero phosphate Relying on the above pathway for b.pdfChorismate 3-glycero phosphate Relying on the above pathway for b.pdf
Chorismate 3-glycero phosphate Relying on the above pathway for b.pdf
arrowcomputers8700
 
A form of favoritism where you give preferential treatment to your f.pdf
A form of favoritism where you give preferential treatment to your f.pdfA form of favoritism where you give preferential treatment to your f.pdf
A form of favoritism where you give preferential treatment to your f.pdf
arrowcomputers8700
 
2.Describe a technique that would allow a developmental biologist to.pdf
2.Describe a technique that would allow a developmental biologist to.pdf2.Describe a technique that would allow a developmental biologist to.pdf
2.Describe a technique that would allow a developmental biologist to.pdf
arrowcomputers8700
 
4. Smircich and Morgan (1982), in an earlier reading, identified “le.pdf
4. Smircich and Morgan (1982), in an earlier reading, identified “le.pdf4. Smircich and Morgan (1982), in an earlier reading, identified “le.pdf
4. Smircich and Morgan (1982), in an earlier reading, identified “le.pdf
arrowcomputers8700
 
You are required to write an interactive C program that prompts the .pdf
You are required to write an interactive C program that prompts the .pdfYou are required to write an interactive C program that prompts the .pdf
You are required to write an interactive C program that prompts the .pdf
arrowcomputers8700
 
Which plant cell organelle contains its own DNA and ribosome A) Golg.pdf
Which plant cell organelle contains its own DNA and ribosome  A) Golg.pdfWhich plant cell organelle contains its own DNA and ribosome  A) Golg.pdf
Which plant cell organelle contains its own DNA and ribosome A) Golg.pdf
arrowcomputers8700
 
A living plant leaf is an open system that exchanges energy (sunligh.pdf
A living plant leaf is an open system that exchanges energy (sunligh.pdfA living plant leaf is an open system that exchanges energy (sunligh.pdf
A living plant leaf is an open system that exchanges energy (sunligh.pdf
arrowcomputers8700
 
Which of the following are typically used as input devices A. Print.pdf
Which of the following are typically used as input devices  A. Print.pdfWhich of the following are typically used as input devices  A. Print.pdf
Which of the following are typically used as input devices A. Print.pdf
arrowcomputers8700
 
What is dynamic semantics Can you please explain the many kinds of .pdf
What is dynamic semantics Can you please explain the many kinds of .pdfWhat is dynamic semantics Can you please explain the many kinds of .pdf
What is dynamic semantics Can you please explain the many kinds of .pdf
arrowcomputers8700
 
What happened to Mexicans in the west after the US annexed their lan.pdf
What happened to Mexicans in the west after the US annexed their lan.pdfWhat happened to Mexicans in the west after the US annexed their lan.pdf
What happened to Mexicans in the west after the US annexed their lan.pdf
arrowcomputers8700
 
What are pivot tablesWhat is the table format and how can it save.pdf
What are pivot tablesWhat is the table format and how can it save.pdfWhat are pivot tablesWhat is the table format and how can it save.pdf
What are pivot tablesWhat is the table format and how can it save.pdf
arrowcomputers8700
 
Topology - Imbeddings of Manifolds Prove that every manifold is regu.pdf
Topology - Imbeddings of Manifolds Prove that every manifold is regu.pdfTopology - Imbeddings of Manifolds Prove that every manifold is regu.pdf
Topology - Imbeddings of Manifolds Prove that every manifold is regu.pdf
arrowcomputers8700
 

More from arrowcomputers8700 (20)

How are control charts madeSolutionThe control chart is a gra.pdf
How are control charts madeSolutionThe control chart is a gra.pdfHow are control charts madeSolutionThe control chart is a gra.pdf
How are control charts madeSolutionThe control chart is a gra.pdf
 
GENETICS Millie bought three packages of zinnia seeds for red, orang.pdf
GENETICS Millie bought three packages of zinnia seeds for red, orang.pdfGENETICS Millie bought three packages of zinnia seeds for red, orang.pdf
GENETICS Millie bought three packages of zinnia seeds for red, orang.pdf
 
Figure 5.2 shows a common biological phospholipid called phosphatidy.pdf
Figure 5.2 shows a common biological phospholipid called phosphatidy.pdfFigure 5.2 shows a common biological phospholipid called phosphatidy.pdf
Figure 5.2 shows a common biological phospholipid called phosphatidy.pdf
 
describe the cell categories of nervous tissue and describe the orga.pdf
describe the cell categories of nervous tissue and describe the orga.pdfdescribe the cell categories of nervous tissue and describe the orga.pdf
describe the cell categories of nervous tissue and describe the orga.pdf
 
Describe what is meant by the Internet of Things. What industrie.pdf
Describe what is meant by the Internet of Things. What industrie.pdfDescribe what is meant by the Internet of Things. What industrie.pdf
Describe what is meant by the Internet of Things. What industrie.pdf
 
Create a class named Person. The person class contains first name, .pdf
Create a class named Person. The person class contains first name, .pdfCreate a class named Person. The person class contains first name, .pdf
Create a class named Person. The person class contains first name, .pdf
 
C++ Programming Language N-number queue rotations.Write methods v.pdf
C++ Programming Language N-number queue rotations.Write methods v.pdfC++ Programming Language N-number queue rotations.Write methods v.pdf
C++ Programming Language N-number queue rotations.Write methods v.pdf
 
Assume a disease is dominant, indicated by shading. Based on the pedi.pdf
Assume a disease is dominant, indicated by shading. Based on the pedi.pdfAssume a disease is dominant, indicated by shading. Based on the pedi.pdf
Assume a disease is dominant, indicated by shading. Based on the pedi.pdf
 
Chorismate 3-glycero phosphate Relying on the above pathway for b.pdf
Chorismate 3-glycero phosphate Relying on the above pathway for b.pdfChorismate 3-glycero phosphate Relying on the above pathway for b.pdf
Chorismate 3-glycero phosphate Relying on the above pathway for b.pdf
 
A form of favoritism where you give preferential treatment to your f.pdf
A form of favoritism where you give preferential treatment to your f.pdfA form of favoritism where you give preferential treatment to your f.pdf
A form of favoritism where you give preferential treatment to your f.pdf
 
2.Describe a technique that would allow a developmental biologist to.pdf
2.Describe a technique that would allow a developmental biologist to.pdf2.Describe a technique that would allow a developmental biologist to.pdf
2.Describe a technique that would allow a developmental biologist to.pdf
 
4. Smircich and Morgan (1982), in an earlier reading, identified “le.pdf
4. Smircich and Morgan (1982), in an earlier reading, identified “le.pdf4. Smircich and Morgan (1982), in an earlier reading, identified “le.pdf
4. Smircich and Morgan (1982), in an earlier reading, identified “le.pdf
 
You are required to write an interactive C program that prompts the .pdf
You are required to write an interactive C program that prompts the .pdfYou are required to write an interactive C program that prompts the .pdf
You are required to write an interactive C program that prompts the .pdf
 
Which plant cell organelle contains its own DNA and ribosome A) Golg.pdf
Which plant cell organelle contains its own DNA and ribosome  A) Golg.pdfWhich plant cell organelle contains its own DNA and ribosome  A) Golg.pdf
Which plant cell organelle contains its own DNA and ribosome A) Golg.pdf
 
A living plant leaf is an open system that exchanges energy (sunligh.pdf
A living plant leaf is an open system that exchanges energy (sunligh.pdfA living plant leaf is an open system that exchanges energy (sunligh.pdf
A living plant leaf is an open system that exchanges energy (sunligh.pdf
 
Which of the following are typically used as input devices A. Print.pdf
Which of the following are typically used as input devices  A. Print.pdfWhich of the following are typically used as input devices  A. Print.pdf
Which of the following are typically used as input devices A. Print.pdf
 
What is dynamic semantics Can you please explain the many kinds of .pdf
What is dynamic semantics Can you please explain the many kinds of .pdfWhat is dynamic semantics Can you please explain the many kinds of .pdf
What is dynamic semantics Can you please explain the many kinds of .pdf
 
What happened to Mexicans in the west after the US annexed their lan.pdf
What happened to Mexicans in the west after the US annexed their lan.pdfWhat happened to Mexicans in the west after the US annexed their lan.pdf
What happened to Mexicans in the west after the US annexed their lan.pdf
 
What are pivot tablesWhat is the table format and how can it save.pdf
What are pivot tablesWhat is the table format and how can it save.pdfWhat are pivot tablesWhat is the table format and how can it save.pdf
What are pivot tablesWhat is the table format and how can it save.pdf
 
Topology - Imbeddings of Manifolds Prove that every manifold is regu.pdf
Topology - Imbeddings of Manifolds Prove that every manifold is regu.pdfTopology - Imbeddings of Manifolds Prove that every manifold is regu.pdf
Topology - Imbeddings of Manifolds Prove that every manifold is regu.pdf
 

Recently uploaded

Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
Murugan Solaiyappan
 
How to Manage Access Rights & User Types in Odoo 17
How to Manage Access Rights & User Types in Odoo 17How to Manage Access Rights & User Types in Odoo 17
How to Manage Access Rights & User Types in Odoo 17
Celine George
 
Bedok NEWater Photostory - COM322 Assessment (Story 2)
Bedok NEWater Photostory - COM322 Assessment (Story 2)Bedok NEWater Photostory - COM322 Assessment (Story 2)
Bedok NEWater Photostory - COM322 Assessment (Story 2)
Liyana Rozaini
 
H. A. Roberts: VITAL FORCE - Dr. Niranjan Bapat
H. A. Roberts: VITAL FORCE - Dr. Niranjan BapatH. A. Roberts: VITAL FORCE - Dr. Niranjan Bapat
H. A. Roberts: VITAL FORCE - Dr. Niranjan Bapat
Niranjan Bapat
 
2024 KWL Back 2 School Summer Conference
2024 KWL Back 2 School Summer Conference2024 KWL Back 2 School Summer Conference
2024 KWL Back 2 School Summer Conference
KlettWorldLanguages
 
Allopathic M1 Srudent Orientation Powerpoint
Allopathic M1 Srudent Orientation PowerpointAllopathic M1 Srudent Orientation Powerpoint
Allopathic M1 Srudent Orientation Powerpoint
Julie Sarpy
 
Principles of Roods Approach!!!!!!!.pptx
Principles of Roods Approach!!!!!!!.pptxPrinciples of Roods Approach!!!!!!!.pptx
Principles of Roods Approach!!!!!!!.pptx
ibtesaam huma
 
matatag curriculum education for Kindergarten
matatag curriculum education for Kindergartenmatatag curriculum education for Kindergarten
matatag curriculum education for Kindergarten
SarahAlie1
 
C Interview Questions PDF By Scholarhat.pdf
C Interview Questions PDF By Scholarhat.pdfC Interview Questions PDF By Scholarhat.pdf
C Interview Questions PDF By Scholarhat.pdf
Scholarhat
 
Individual Performance Commitment Review Form-Developmental Plan.docx
Individual Performance Commitment Review Form-Developmental Plan.docxIndividual Performance Commitment Review Form-Developmental Plan.docx
Individual Performance Commitment Review Form-Developmental Plan.docx
monicaaringo1
 
modul ajar kelas x bahasa inggris 2024-2025
modul ajar kelas x bahasa inggris 2024-2025modul ajar kelas x bahasa inggris 2024-2025
modul ajar kelas x bahasa inggris 2024-2025
NurFitriah45
 
How to Create a New Article in Knowledge App in Odoo 17
How to Create a New Article in Knowledge App in Odoo 17How to Create a New Article in Knowledge App in Odoo 17
How to Create a New Article in Knowledge App in Odoo 17
Celine George
 
Odoo 17 Social Marketing - Lead Generation On Facebook
Odoo 17 Social Marketing - Lead Generation On FacebookOdoo 17 Social Marketing - Lead Generation On Facebook
Odoo 17 Social Marketing - Lead Generation On Facebook
Celine George
 
Genetics Teaching Plan: Dr.Kshirsagar R.V.
Genetics Teaching Plan: Dr.Kshirsagar R.V.Genetics Teaching Plan: Dr.Kshirsagar R.V.
Genetics Teaching Plan: Dr.Kshirsagar R.V.
DrRavindrakshirsagar1
 
Imagination in Computer Science Research
Imagination in Computer Science ResearchImagination in Computer Science Research
Imagination in Computer Science Research
Abhik Roychoudhury
 
How to Create & Publish a Blog in Odoo 17 Website
How to Create & Publish a Blog in Odoo 17 WebsiteHow to Create & Publish a Blog in Odoo 17 Website
How to Create & Publish a Blog in Odoo 17 Website
Celine George
 
Kesadaran_Berbangsa_dan_Bernegara_Nasion.pptx
Kesadaran_Berbangsa_dan_Bernegara_Nasion.pptxKesadaran_Berbangsa_dan_Bernegara_Nasion.pptx
Kesadaran_Berbangsa_dan_Bernegara_Nasion.pptx
artenzmartenkai
 
CTD Punjab Police Past Papers MCQs PPSC PDF
CTD Punjab Police Past Papers MCQs PPSC PDFCTD Punjab Police Past Papers MCQs PPSC PDF
CTD Punjab Police Past Papers MCQs PPSC PDF
hammadmughal76316
 
AZ-900 Microsoft Azure Fundamentals Summary.pdf
AZ-900 Microsoft Azure Fundamentals Summary.pdfAZ-900 Microsoft Azure Fundamentals Summary.pdf
AZ-900 Microsoft Azure Fundamentals Summary.pdf
OlivierLumeau1
 
Edukasyong Pantahanan at Pangkabuhayan 1: Personal Hygiene
Edukasyong Pantahanan at  Pangkabuhayan 1: Personal HygieneEdukasyong Pantahanan at  Pangkabuhayan 1: Personal Hygiene
Edukasyong Pantahanan at Pangkabuhayan 1: Personal Hygiene
MJDuyan
 

Recently uploaded (20)

Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
Lecture_Notes_Unit4_Chapter_8_9_10_RDBMS for the students affiliated by alaga...
 
How to Manage Access Rights & User Types in Odoo 17
How to Manage Access Rights & User Types in Odoo 17How to Manage Access Rights & User Types in Odoo 17
How to Manage Access Rights & User Types in Odoo 17
 
Bedok NEWater Photostory - COM322 Assessment (Story 2)
Bedok NEWater Photostory - COM322 Assessment (Story 2)Bedok NEWater Photostory - COM322 Assessment (Story 2)
Bedok NEWater Photostory - COM322 Assessment (Story 2)
 
H. A. Roberts: VITAL FORCE - Dr. Niranjan Bapat
H. A. Roberts: VITAL FORCE - Dr. Niranjan BapatH. A. Roberts: VITAL FORCE - Dr. Niranjan Bapat
H. A. Roberts: VITAL FORCE - Dr. Niranjan Bapat
 
2024 KWL Back 2 School Summer Conference
2024 KWL Back 2 School Summer Conference2024 KWL Back 2 School Summer Conference
2024 KWL Back 2 School Summer Conference
 
Allopathic M1 Srudent Orientation Powerpoint
Allopathic M1 Srudent Orientation PowerpointAllopathic M1 Srudent Orientation Powerpoint
Allopathic M1 Srudent Orientation Powerpoint
 
Principles of Roods Approach!!!!!!!.pptx
Principles of Roods Approach!!!!!!!.pptxPrinciples of Roods Approach!!!!!!!.pptx
Principles of Roods Approach!!!!!!!.pptx
 
matatag curriculum education for Kindergarten
matatag curriculum education for Kindergartenmatatag curriculum education for Kindergarten
matatag curriculum education for Kindergarten
 
C Interview Questions PDF By Scholarhat.pdf
C Interview Questions PDF By Scholarhat.pdfC Interview Questions PDF By Scholarhat.pdf
C Interview Questions PDF By Scholarhat.pdf
 
Individual Performance Commitment Review Form-Developmental Plan.docx
Individual Performance Commitment Review Form-Developmental Plan.docxIndividual Performance Commitment Review Form-Developmental Plan.docx
Individual Performance Commitment Review Form-Developmental Plan.docx
 
modul ajar kelas x bahasa inggris 2024-2025
modul ajar kelas x bahasa inggris 2024-2025modul ajar kelas x bahasa inggris 2024-2025
modul ajar kelas x bahasa inggris 2024-2025
 
How to Create a New Article in Knowledge App in Odoo 17
How to Create a New Article in Knowledge App in Odoo 17How to Create a New Article in Knowledge App in Odoo 17
How to Create a New Article in Knowledge App in Odoo 17
 
Odoo 17 Social Marketing - Lead Generation On Facebook
Odoo 17 Social Marketing - Lead Generation On FacebookOdoo 17 Social Marketing - Lead Generation On Facebook
Odoo 17 Social Marketing - Lead Generation On Facebook
 
Genetics Teaching Plan: Dr.Kshirsagar R.V.
Genetics Teaching Plan: Dr.Kshirsagar R.V.Genetics Teaching Plan: Dr.Kshirsagar R.V.
Genetics Teaching Plan: Dr.Kshirsagar R.V.
 
Imagination in Computer Science Research
Imagination in Computer Science ResearchImagination in Computer Science Research
Imagination in Computer Science Research
 
How to Create & Publish a Blog in Odoo 17 Website
How to Create & Publish a Blog in Odoo 17 WebsiteHow to Create & Publish a Blog in Odoo 17 Website
How to Create & Publish a Blog in Odoo 17 Website
 
Kesadaran_Berbangsa_dan_Bernegara_Nasion.pptx
Kesadaran_Berbangsa_dan_Bernegara_Nasion.pptxKesadaran_Berbangsa_dan_Bernegara_Nasion.pptx
Kesadaran_Berbangsa_dan_Bernegara_Nasion.pptx
 
CTD Punjab Police Past Papers MCQs PPSC PDF
CTD Punjab Police Past Papers MCQs PPSC PDFCTD Punjab Police Past Papers MCQs PPSC PDF
CTD Punjab Police Past Papers MCQs PPSC PDF
 
AZ-900 Microsoft Azure Fundamentals Summary.pdf
AZ-900 Microsoft Azure Fundamentals Summary.pdfAZ-900 Microsoft Azure Fundamentals Summary.pdf
AZ-900 Microsoft Azure Fundamentals Summary.pdf
 
Edukasyong Pantahanan at Pangkabuhayan 1: Personal Hygiene
Edukasyong Pantahanan at  Pangkabuhayan 1: Personal HygieneEdukasyong Pantahanan at  Pangkabuhayan 1: Personal Hygiene
Edukasyong Pantahanan at Pangkabuhayan 1: Personal Hygiene
 

Discuss the relationship between some of the common file classes in .pdf

  • 1. Discuss the relationship between some of the common file classes in the Java API, the types of exceptions that can be thrown, and the best ways to handle the possible exceptions. Solution Common Files classes in java listed below: 1. Byte Streams class a. FileInputStrream ---It throws IOException b.FileOutputStream ---It Throws IOException 2. Character Streams class a. FileReader ---It Throws IOEception b. FileWriter ---It throws IOException 3. Buffered Stream a. BufferedReader ---It Throws IOEception b. BufferedWriter ---It Throws IOEception c. BufferedInputStream ---It Throws IOEception d. BufferedOutputStream ---It Throws IOEception 4. Data Streams a. DataInputStream ---It Throws IOEception b.DataOutputStream ---It Throws IOEception 5. Object Stream a. ObjectInputStream --it throws ClassNotFoundException b. ObjectOutputStream --it throws ClassNotFoundException They can also Throw FileNotFoundException Best solution is use try and catch block for catching exception If you want to catch any speific exception any you can give specific name in catch block otherwise you can give Exception. Ex. try{ .... //code }catch(FileNotFoundException exception) { }catch(IOException exception) {
  • 2. }catch(Exception exception) { } If you do not want to handle the exception then you can thow the exception using throws keyword Thanks a lot