Created
November 30, 2012 22:35
-
-
Save 0x000000AC/4179197 to your computer and use it in GitHub Desktop.
This program show swhat happens when you call the length method with strings of different lengths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************** | |
* LengthMethod.java | |
* Aaron P. Clark | |
* | |
* This program shows what happens when you call the length method with strings of different lenths. | |
***********************************************/ | |
public class LengthMethod | |
{ | |
public static void main(String[] args) | |
{ | |
String s1 = "hi"; | |
String s2 = ""; | |
System.out.println("number of characters in s1 = " + s1.length()); | |
System.out.println("number of characters in s2 = " + s2.length()); | |
} // end main | |
} // end class TestExpressions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment