Skip to content

Commit 792f054

Browse files
committed
updated the S3 Java ListBuckets example
1 parent 7fdc2cd commit 792f054

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

javav2/example_code/s3/src/main/java/com/example/s3/ListBuckets.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ public static void main(String[] args) {
3737
public static void listAllBuckets(S3Client s3) {
3838
ListBucketsResponse response = s3.listBuckets();
3939
List<Bucket> bucketList = response.buckets();
40-
for (Bucket bucket: bucketList) {
41-
System.out.println("Bucket name "+bucket.name());
40+
// Print bucket names
41+
System.out.println("Your Amazon S3 buckets are:");
42+
for (Bucket bucket : bucketList) {
43+
System.out.println(bucket.name());
44+
System.out.println(bucket.creationDate());
4245
}
4346
}
4447
}

0 commit comments

Comments
 (0)