*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "String" Watch "String" New topic
Author

String

Rishi Wright
Ranch Hand

Joined: Jun 25, 2003
Posts: 46
Hi 'all
public class Test {
public static void main (String args []) {
String s="AB";
System.out.println(s.startsWith("",2));//1
System.out.println(s.startsWith(" ",2));/2
System.out.println(s.startsWith("",3));//3
}
}
at line //1 it prints true where as at //2 it prints false.Is there any difference between ""&" "???
thnx
rishi
Vikram Reddy
Greenhorn

Joined: Jan 06, 2003
Posts: 17
(" ") represents a blank space (string of length 1) and ("") is nothing (string of length 0).
HTH.
--Vikram


SCJP-1.4; SCWCD-EE5<br />---------<br />Sky is not the limit......
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String
 
Similar Threads
Char
Three dim array
increment post and pre, when used in println
simple array assignment question
age old encoding questions