Wednesday, February 11, 2015

How About Some More??

So here is some more coding for ya. The beginning of coding is the most boring thing I can think of, but it is necessary. We are going to capitalize and lowercase San Francisco. And since I can't really think of anything for myself, I need to decide how many characters are in San Francisco. Oh and what is the first letter of San Francisco? I need to write code to decide this for me. Here is an example of how boring early computer science can be:

public class Strings
{
  public static void main(String[] args)
  {
    String message = "San Francisco";
    String upper = message.toUpperCase();
    String lower = message.toLowerCase();
    char letter = message.charAt(0);
    int stringSize = message.length();
   
    System.out.println(message);
    System.out.println(upper);
    System.out.println(lower);
    System.out.println(letter);
    System.out.println(stringSize);
  }
}

Here is the command prompt:
San Francisco
SAN FRANCISCO
san francisco
S
13

No comments:

Post a Comment