20111019

20111019 - Week 7 Object-Oriented Programming Team...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Office of Instructional and Research Week 7 Object-Oriented Programming Team Programming Assignment #2 continued ITI 202
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Office of Instructional and Research Today: Useful Bits from the Past Debugger (for real this time) Team Assignment #2
Background image of page 2
Office of Instructional and Research Methods public class methods { static void printYikes() { System. out.println("Yikes"); } static int doubleMyNumber(int a) { int b = a * 2; return b; } public static void main(String[ ] args) { printYikes(); int x = 12; System.out.println( "x is " + x ); x = doubleMyNumber(x); System.out.println( "x is " + x ); } }
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Office of Instructional and Research Try… Catch… try { String myString = "a"; int i = Integer.parseInt(myString); //this line will throw a NumberFormatException. It will also throw an exception if you use Integer.parseInt on the String: "2.35" which is a float number System.out.println("myString is an int number: " + myString); } catch (NumberFormatException nfe) { System.out.println("The string entered is not an integer: " + myString); }
Background image of page 4
Office of Instructional and Research Other tricks with Strings int compareTo(String anotherString) Compares two strings lexicographically. int
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

20111019 - Week 7 Object-Oriented Programming Team...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online