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?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education