600.107 Intro to Programming in Java - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

600.107 Intro to Programming in Java

Description:

Good programming practice to use them wherever appropraite. ... quotation mark n = takes the cursor to the next line = if you want to print a backslash ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 9
Provided by: jaima
Category:

less

Transcript and Presenter's Notes

Title: 600.107 Intro to Programming in Java


1
600.107 Intro to Programming in Java
  • Jai Madhok
  • Teaching Assistant
  • 5th July 2007

2
Todays Agenda
  • Miscellaneous Details (finals, operators, etc)
  • Using built in Java classes and their functions
  • Math Class
  • Character Class
  • File Input/Output
  • Example filesDemo.java
  • College Pro Painters- Guided Lab exercize

3
The final
  • Usage- for named constants- reserve word
  • Examples
  • conversion rates for currency
  • measurement units for cooking
  • length-weight conversions, etc
  • Why use them?
  • What are the advantages?
  • Good programming practice to use them wherever
    appropraite.

4
Assignment Combinations
  • , - , , /
  • Useful- make code simpler to understand
  • Looks cleaner
  • Can help save a lot of typing in programs where
    arithmetic operations are used a lot
  • Some examples

5
Commonly used escape sequences
  • Can be used to format output on screen or onto
    files, etc
  • \t leaves a tab space
  • \ quotation mark
  • \n takes the cursor to the next line
  • \\ if you want to print a backslash
  • Few more in the text, these are the main ones
  • Use them whenever you feel the need to

6
The String Class its methods
  • char charAt(int index)
  • int indexOf(char ch)
  • String concat(String str)
  • int length()
  • String substring()- 2 types
  • String toUpperCase()
  • String toLowerCase()
  • Concatenation with

7
Math Class
  • Math.ceil()
  • Math.floor()
  • Math.pow()
  • Others in the text and in the documentation

8
Files
  • Why use files?
  • Reading data from a formatted file
  • Writing output onto a file
Write a Comment
User Comments (0)
About PowerShow.com