Name ______________________
Assume the following:
String a = "abc"; String h = "Hello"; String name = "Michael Maus";
Show what is printed by each of these statements.
System.out.println( h.length() );System.out.println( "SPQR".length() );System.out.println( a.length() + a );System.out.println( " x y ".trim().length() );System.out.println( h.substring(1) );System.out.println( "Tomorrow".substring(2,4) );System.out.println( h.charAt(1) );System.out.println( h.toUpperCase() );System.out.println( h.toUpperCase().toLowerCase() );System.out.println( h.indexOf("H") );System.out.println( "Tomorrow".indexOf("o") );System.out.println( "Tomorrow".indexOf("o", 3) );System.out.println( "Tomorrow".lastIndexOf('o') );System.out.println( name.substring(name.indexOf(" ")+1) );System.out.println( a.substring(1,3).equals("bc") );System.out.println( a.equals("ABC") );System.out.println( a.equalsIgnoreCase("ABC") );System.out.println( a.substring(1,3) == "bc" );System.out.println( "a".compareTo("c") < 0 );System.out.println( "apple".compareTo("applet") >= 0 );System.out.println( "applet".compareTo("application") >= 0 );System.out.println( "a = \"" + a + "\"" );System.out.println( "\\".length() );