COMP248_Tutorial03

COMP248_Tutorial03 - COMP248 Tutorial 3 Comp248/F09 1...

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

View Full Document Right Arrow Icon
Comp248/F09 1 COMP248 Tutorial 3
Background image of page 1

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

View Full DocumentRight Arrow Icon
Strings What is the output of: String s1, s2, s3; s1 = “Quest for the holy Grail”; s2 = s1.toLowerCase(); s3 = s1 + “ ” + s2; System.out.println(s3.replace(‘h’, ‘z’)); What is the length of the string “mississipi”? What is the index of the last character? Comp248/F09 2
Background image of page 2
Assume the String variable s contains the Value “Agent”. What is the effect of the assignment s = s + s.length()? What about s += s.length; Assume the following declaration: String name = “Your Name Here”; What is the value of each of the following expressions? name.substring(9); name.substring(1, 6); name.substring(1, name.length()-1); name.length(); name.indexOf(‘r’); name.indexOf(‘n’); Comp248/F09 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Suppose the following definitions final int MAXIMUM = 100, MINMUM = 1, LIMIT = 100; int num1 = 12, num2 = 25; int num3 = 87; String s1, s2, s3; s1 = "Jave_Homeworks_Are_Very_Hard "; s2= "Hard"; s3= ""; What is the output of the following independent fragments
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/30/2011 for the course COMP 248 taught by Professor T.b.a during the Winter '08 term at Concordia Canada.

Page1 / 7

COMP248_Tutorial03 - COMP248 Tutorial 3 Comp248/F09 1...

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

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