Java Reference
In-Depth Information
// Reverse the content
sb.reverse();
printDetails(sb);
}
public static void printDetails(StringBuilder sb) {
System.out.println("Content: \"" + sb + "\"");
System.out.println("Length: " + sb.length());
System.out.println("Capacity: " + sb.capacity());
// Print an empty line to separate results
System.out.println();
}
}
Content: ""
Length: 0
Capacity: 16
Content: "blessings"
Length: 9
Capacity: 16
Content: "Good blessings"
Length: 14
Capacity: 16
Content: "God blessings"
Length: 13
Capacity: 16
Content: "God blessings be with you"
Length: 25
Capacity: 34
Content: "God"
Length: 3
Capacity: 34
Content: "doG"
Length: 3
Capacity: 34
Search WWH ::




Custom Search