RU beehive logo ITEC dept promo banner
ITEC 120
2010fall
ibarland

homeinfolectslabsexamshws
tutor/PIsbreeze (snow day)
Object120 + its docsjava.lang docsjava.util docs

lect10c
searching for max
and, reading from a Scanner

The remaining weeks' topics, jfyi:

Shorthand notation:

Consider the following function:

  static String mystery( String s, int a, int b ) {
    String somethingSoFar = "";
    for ( int i=a;  i < b && i < s.length();  i += 1 ) {
      somethingSoFar += s.charAt(i);
    }
    return somethingSoFar;
  }

We will go through some of these in lecture; on your own work through the remaining problems (seeing me or a peer instructor if you have difficulties/questions). (These are all eminently reasonable questions for an exam!)
In all cases, come up with at least 3 test cases.


If we finish these examples, we will talk about:


Future exercises:


1 However if you ever have a constructor which doesn't initialize a field, Java will let you compile in that case; then Java will initialize all your fields to "a zero-ish value" for you. If you ever see a nullPointerException it means you're using a field you never initialized. It is sound practice to always initialize all your fields yourself — if nothing else, you'll never have to look at your code later and wonder “gee, did I intend to leave the field uninitialized, or is there a latent bug hiding in this program?”.      

homeinfolectslabsexamshws
tutor/PIsbreeze (snow day)
Object120 + its docsjava.lang docsjava.util docs


©2010, Ian Barland, Radford University
Last modified 2010.Nov.05 (Fri)
Please mail any suggestions
(incl. typos, broken links)
to iba�rlandrad�ford.edu
Powered by PLT Scheme