anIMation Tr ace code String s ="Welcome to Javai String String sl new String("Welcome to Java)i Interned string object for Welcome to java String S2=sintern( String s3 =Welcome to Java"i iang, Introduction to Java Programming, Sixth Edition, (c)2005 Pearson Education, Inc. All rights reserved. 0-13-148952-6
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved. 0-13-148952-6 11 Trace Code String s = "Welcome to Java"; String s1 = new String("Welcome to Java"); String s2 = s.intern(); String s3 = "Welcome to Java"; : String Interned string object for "Welcome to Java" s animation
Tr ace code String s ="Welcome to Javai String String s1= new String("Welcome to Java)i Interned string object for Welcome to Java String s2 =s intern() String s3 =Welcome to Java"i String A string object for Welcome to J iang, Introduction to Java Programming, Sixth Edition, (c)2005 Pearson Education, Inc. All rights reserved. 0-13-148952-6
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved. 0-13-148952-6 12 Trace Code String s = "Welcome to Java"; String s1 = new String("Welcome to Java"); String s2 = s.intern(); String s3 = "Welcome to Java"; : String Interned string object for "Welcome to Java" : String A string object for "Welcome to Java" s s1
Tr ace code string s ="Welcome to Java . String s2匚 String sl new String("Welcome to Java)i Interned string object for Welcome to Java String s2= s intern()i String s3 =Welcome to Java"i String A string object for Welcome to java iang, Introduction to Java Programming, Sixth Edition, (c)2005 Pearson Education, Inc. All rights reserved. 0-13-148952-6
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved. 0-13-148952-6 13 Trace Code String s = "Welcome to Java"; String s1 = new String("Welcome to Java"); String s2 = s.intern(); String s3 = "Welcome to Java"; : String Interned string object for "Welcome to Java" : String A string object for "Welcome to Java" s s1 s2
Tr ace code String s ="Welcome to Javai String S2 String sl new String("Welcome to Java)i Interned string object for Welcome to Java String S2=sintern( String s3=Welcome to Javai String A string object for Welcome to java iang, Introduction to Java Programming, Sixth Edition, (c)2005 Pearson Education, Inc. All rights reserved. 0-13-148952-6
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved. 0-13-148952-6 14 Trace Code String s = "Welcome to Java"; String s1 = new String("Welcome to Java"); String s2 = s.intern(); String s3 = "Welcome to Java"; : String Interned string object for "Welcome to Java" : String A string object for "Welcome to Java" s s1 s2 s3
Finding string Length Finding string length using the length() method message WElcome; message length()(returns 7) iang, Introduction to Java Programming, Sixth Edition, (c)2005 Pearson Education, Inc. All rights reserved. 0-13-148952-6
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved. 0-13-148952-6 15 Finding String Length Finding string length using the length() method: message = "Welcome"; message.length() (returns 7)