-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPersonTwo.java
More file actions
32 lines (28 loc) · 990 Bytes
/
PersonTwo.java
File metadata and controls
32 lines (28 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Administrator
*/
public class PersonTwo {
public StringBuilder name = new StringBuilder(8);
public StringBuilder phoneNumber = new StringBuilder();
public void displayPersonInfo(){
// Populate the name object
name.append("Fernando");
name.append(" ");
name.append("Gonzalez");
// Display the name and the capacity of the object
System.out.println("Name: "+ name.toString());
System.out.println("Name object capacity: " + name.capacity());
// Replace first name
System.out.println("First Name: "+ name.substring(0, 8));
// Populate the phoneNumber object
phoneNumber.append("5551234567");
phoneNumber.insert(3, "-");
phoneNumber.insert(7, "-");
System.out.println("Phone number: " + phoneNumber.toString());
}
}