Question

What is the difference between the String class and the StringBuilder class in the API? Group of answer choices they are in d
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Yes, Option a String is immutable and a StringBulider is mutable is Correct Option.

The String and StringBulider both are in same package called Java.lang, so Option they are in different packages is Incorrect Option.

String is type of array which contains charcters as letters and StringBulider does the same. So Option a string can only contain letters while a StringBuilder can contain any character is Incorrect Option.

As you seen there is difference String and StringBuilder so, Option there is no difference is Incorrect Option.

Yes, Option False is Correct Option.

In question A class can directly extend many classes,the extend(extends in java programming) keyword extends a class indicate that one class inherited from another class.

You can only directly extend one class because Java does not support Multiple inheritance. However in Java multiple inheritance possible through interfaces only. A class can implement any number of interfaces but can extend only one class.

Yes, Option the address of Student object is Correct Option.

With this declartion
Student s1;

Here Student is not a any type of Data type.So we can not write it directly as variable member.It must be in a class Student in which Student s1 will be link Address or reference as s1 of Student class.In this way s1 hold the address of Student Object.

Please refer this code image for better approach:

public class Student { Student sl; //link Address or reference as sl of Student class }

We aren't using object when we assign an object to variable so it is just the address of Student Object not only Student Object. So Option a Student object is Incorrect Option.

As you can see this is not any data type so it will not a String,So Option a String is Incorrect Option.

It can not be address of any Object it will be address of Student class only, So Option the address of any object is Incorrect Option.

Add a comment
Know the answer?
Add Answer to:
What is the difference between the String class and the StringBuilder class in the API? Group...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please answer question (5 points) Below is the skeleton for a simplified StringBuilder class as done...

    please answer question (5 points) Below is the skeleton for a simplified StringBuilder class as done in the Closed Lab this semester. As in the lab, the class has an ArrayList of Character to hold the individual characters of the StringBuilder object. Write the instance method indexOf as given below that returns the index of the first occurrence of the character c in the SimplestringBuilder. If there is no index for that character (i.e. the character is not in the...

  • Using loops with the String and Character classes. You can also use the StringBuilder class to...

    Using loops with the String and Character classes. You can also use the StringBuilder class to concatenate all the error messages. Floating point literals can be expressed as digits with one decimal point or using scientific notation. 1 The only valid characters are digits (0 through 9) At most one decimal point. At most one occurrence of the letter 'E' At most two positive or negative signs. examples of valid expressions: 3.14159 -2.54 2.453E3 I 66.3E-5 Write a class definition...

  • 1. What is the difference between 'String' objects and 'StringBuilder' objects? 2, List and define three...

    1. What is the difference between 'String' objects and 'StringBuilder' objects? 2, List and define three methods contained in class 'Matcher'

  • language is java Restrictions: You are not allowed to use anything from the String, StringBuilder, or...

    language is java Restrictions: You are not allowed to use anything from the String, StringBuilder, or Wrapper classes. In general, you may not use anything from any other Java classes, unless otherwise specified. You are not allowed to use String literals in your code ("this is a string literal"). You are not allowed to use String objects in your code. The methods must be implemented by manipulating the data field array, The CSString Class: NOTE: Pay very careful attention to...

  • In Java Only can use class String length charAt class StringBuilder length charAt append toString class...

    In Java Only can use class String length charAt class StringBuilder length charAt append toString class Character any method Create the following methods nthWord takes an int and a String as input and returns a String: The input int represents a number n that is assumed to be positive, and the output string contains every nth word of the input string, starting with the first word, separated by a single space. {\em For this method, a word is defined to...

  • Class StringImproved public class StringImproved extends java.lang.Object This program replaces the string class with a mutable...

    Class StringImproved public class StringImproved extends java.lang.Object This program replaces the string class with a mutable string. This class represents a character array and provide functionalities need to do basic string processing. It contains an array of characters, representing a textual string. Overview In Java, Strings are a great device for storing arrays of characters. One limitation of Strings in Java, however (there is always at least one), is that they are immutable (ie. they cannot be changed once created)....

  • Purpose: Once you have completed and tested the functionality of your MyStringBuilder class, you will do...

    Purpose: Once you have completed and tested the functionality of your MyStringBuilder class, you will do a rough comparative test to see how long some of the operations take relative to the predefined StringBuilder class and the predefined String class. Details: You will complete a simple simulation to compare the times required for three operations: append(char c) , insert(int loc, char c) and delete(int start, int stop) These methods are defined in the StringBuilder and MyStringBuilder classes, but you will...

  • Write a class StringsAndThings. The class has one instance variable of type String and a constructor...

    Write a class StringsAndThings. The class has one instance variable of type String and a constructor with a parameter to initialize the instance variable. The parameter could contain any characters, including letters, digits, spaces, special characters (+, -, $, @,...), and punctuation marks. Write methods: countNonLetters - that will count how many of the characters in the string are not letters. You can use Character's isLetter method. moreVowels - which returns true if the String parameter has more vowels than...

  • hello there, still confused. What is the difference between a c-string and a string class object?...

    hello there, still confused. What is the difference between a c-string and a string class object? In a short paragraph describe three differences.

  • CS 2050 – Programming Project # 1 Due Date: Session 3 (that is, in one week!)....

    CS 2050 – Programming Project # 1 Due Date: Session 3 (that is, in one week!). Can be resubmitted up to two times until Session 6 if your first version is submitted by session 3. In this project, you create two classes for tracking students. One class is the Student class that holds student data; the other is the GradeItem class that holds data about grades that students earned in various courses. Note: the next three projects build on this...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT