2) Programming in JAVA, 2nd Ed, Sachin Malhotra &SaurabhChoudhary, String Manipulations and
Oxford Press Introduction to Packages
3) Core Java – SYBSC CS – Sheth Publication – Prof. Ahtesham Shaikh,
Prof.Beena Kapadia
3) The Java Tutorials: http://docs.oracle.com/javase/tutorial/
3.6 QUESTIONS:
1) What is a string? Write a program to accept a string as a command line
argument and print its reverse.
2) What is a string? Explain, with example, the following methods of
String class:
(i) indexOf() (ii) substring()
3) What is a package? Explain
4) List any five predefine packages in java.
5) What is the purpose of java.utilpackage. List any five classes or
interfaces.
6) What is the purpose of java.io package. List any five classes or
interfaces.
7) What is the purpose of java.sqlpackage. List any five classes or
interfaces.
8) How to define use defined package? How JVM locates user defined
packages? Explain.
9) Explain the visibility of class and there members for different access
specifier.
49
, Unit II
4
EXCEPTION HANDLING
Unit Structure
4.1 Introduction
4.2 Types of errors
4.3 Exceptions
4.4 Syntax of Exception Handling Code
4.5 Multiple catch Statements
4.6 Using finally Statement
4.7 Throw and throws keyword
4.9 Using Exception for debugging
4.9 Summary
4.10 Textbook
4.11 Additional References
4.12 Questions
4.1 INTRODUCTION
Rarely does a program run successfully at its very first attempt. It is very
common to make mistakes while developing as well as typing a program.
A mistake might lead to an error causing the program to produce
unexpected results. Errors can make a program go wrong.
An error may terminate the execution of the program or may produce an
incorrect output or even may cause the system to crash. It is important to
detect and manage properly all the possible error condition in the program
so that the program will not terminate/crash during execution.
4.2 TYPES OF ERRORS
Errors may be classified into two categories:
Compile-time errors
Run-time errors
50
Oxford Press Introduction to Packages
3) Core Java – SYBSC CS – Sheth Publication – Prof. Ahtesham Shaikh,
Prof.Beena Kapadia
3) The Java Tutorials: http://docs.oracle.com/javase/tutorial/
3.6 QUESTIONS:
1) What is a string? Write a program to accept a string as a command line
argument and print its reverse.
2) What is a string? Explain, with example, the following methods of
String class:
(i) indexOf() (ii) substring()
3) What is a package? Explain
4) List any five predefine packages in java.
5) What is the purpose of java.utilpackage. List any five classes or
interfaces.
6) What is the purpose of java.io package. List any five classes or
interfaces.
7) What is the purpose of java.sqlpackage. List any five classes or
interfaces.
8) How to define use defined package? How JVM locates user defined
packages? Explain.
9) Explain the visibility of class and there members for different access
specifier.
49
, Unit II
4
EXCEPTION HANDLING
Unit Structure
4.1 Introduction
4.2 Types of errors
4.3 Exceptions
4.4 Syntax of Exception Handling Code
4.5 Multiple catch Statements
4.6 Using finally Statement
4.7 Throw and throws keyword
4.9 Using Exception for debugging
4.9 Summary
4.10 Textbook
4.11 Additional References
4.12 Questions
4.1 INTRODUCTION
Rarely does a program run successfully at its very first attempt. It is very
common to make mistakes while developing as well as typing a program.
A mistake might lead to an error causing the program to produce
unexpected results. Errors can make a program go wrong.
An error may terminate the execution of the program or may produce an
incorrect output or even may cause the system to crash. It is important to
detect and manage properly all the possible error condition in the program
so that the program will not terminate/crash during execution.
4.2 TYPES OF ERRORS
Errors may be classified into two categories:
Compile-time errors
Run-time errors
50