6: Supposed that we have a string with a value “This is my string.”. Which expression can be used to extract the word “my” from the given string?

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

ANSWER TO BE SUBMITTED:

SOURCE CODE 

AND NO.6-10

 

1: Create a new class with attributes name and address. Both data type will be String. Create a constructor and assign the parameters to the attributes. Now override the toString() method. Is this possible?

2: Create a class with the main method and create an instance of the class that you created in Test Stem 1. What method can you call to get the hashCode of your class?

3: What is the return type of the hash code ?

4: Create an instance of the string in your test class and assign a value. Which of the following operators can be used in conjunction with a string object?

  • +
  • -
  • &
  • .
  • +=

5: Supposed that we have a string with a value “This is my string.”. Which method can be used to extract a specific word from the given string?

6: Supposed that we have a string with a value “This is my string.”. Which expression can be used to extract the word “my” from the given string?

7: Now create an String and assign a value with spaces in the beginning, end and middle. Try out the method trim(). What does it do?

8: In your test class with main method, instantiate a string buffer with the initial value of “hello”. How will you be able to do that?

9: In your test class with main method, instantiate a string buffer with the initial value of “hello”. Use the method setLength with parameter 2. Print the string representation of the StringBuffer using toString(). What is the result?

10: Which method is not defined in the StringBuffer class?

a.appends

b. codePointCount

c. insert

d. lastIndexOf

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY