Beginning JAVA Programming CIS 175 - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Beginning JAVA Programming CIS 175

Description:

1. Beginning JAVA Programming CIS 175. File Input re Chapter 13 ... Need throws java.io.IOException. Need InputStreamReader class. Need BufferedReader class ... – PowerPoint PPT presentation

Number of Views:10
Avg rating:3.0/5.0
Slides: 7
Provided by: Bri8383
Category:

less

Transcript and Presenter's Notes

Title: Beginning JAVA Programming CIS 175


1
Beginning JAVA Programming CIS 175
  • File Input re Chapter 13
  • Concepts from Chapter 3

2
Final
  • Used for magic numbers
  • Math.PI is pi
  • Math.E is e
  • Final variables are final they can not change.

3
Terminology
  • parseDouble
  • This is a Double class method
  • Just like Math.pow is a Math class method
  • Notice this is Double not double
  • Double is called a wrapper class

4
parseDouble
  • Converts a string into a double
  • String s "8.0"
  • double x
  • x Double.parseDouble(s)

5
Reading from the keyboard
  • Make a program more flexible
  • Read a string, convert the string into a double
  • Need System.in
  • Need java.io.
  • Need throws java.io.IOException
  • Need InputStreamReader class
  • Need BufferedReader class

6
Exception Handling
  • See page 126
  • Enclose program in a try block
  • catch the errors
  • Allows for removal of throws
Write a Comment
User Comments (0)
About PowerShow.com