public class Strings
1: /**
2: * Strings.java -- just a few String manipulations
3: *
4: * @author Mark Young (A00000000)
5: * @version 1.1, 2014-09-09
6: */
7: public class Strings {
9: public static void main(String[] args) {
10: // a String
11: String name = "Mark Young";
12: System.out.println(name);
13: System.out.println("My name is " + name + ".");
15: // another String
16: String first = "Mark";
17: char middleInitial = 'A';
18: String last = "Young";
19: String full = last + ", " + first + " " + middleInitial + ".";
20: System.out.println("\nfirst == " + first +
21: "\nlast == " + last +
22: "\nfull == " + full);
24: // some String properties and methods
25: System.out.println("\nThe length of the string \"" + name + "\" is " +
26: name.length());
27: System.out.println("The length of the string \"" + full + "\" is " +
28: full.length());
29: System.out.println("The length of the string \"\" is " +
30: "".length());
31: System.out.println("\nIn ALL CAPITALS: " + name.toUpperCase());
32: }
34: }