1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lina2011 [118]
4 years ago
13

(Java) I need help understanding what to code for these methods.

Computers and Technology
1 answer:
Nuetrik [128]4 years ago
7 0

Answer:

public Mysring(char[] Original)

{

        int size= Original.length();

       for(int i=0;i<=size;i++)

       {

           arr[i]=Original[i];

       }

}

Public Mystring(String Original)

{

  char[] arr=String.toCharArray();

}

Public Mystring(Mystring Original)

{

   Int len=Original.arr.length();

   for(int i=0;i<=len;i++)

   {

        arr[i]=Orginal.arr[i];

   }

}

public int length()

{

    Int len=arr.length();

   return len;

}

Public char charAt(int index)

{

     try

     {

      System.out.println(arr[index]);

     }

     catch(IndexOutOfBoundsException ex)

     {

          throw ex;

     }

}

   

}

Explanation:

1) The first one is the Parameterized constructor. It takes an array of character as input, and assigns it to the array of character which is a field in the given class MyString.

2) The second one is also the Parameterized constructor, and it takes a string as input, and converts it to an array of characters, and finally assigns it to the character type field of the class MyString.

3) The third one is the copy constructor, and takes a previous object of the class as input, and assigns its values to the new instance of the class.

4) The fourth function returns the length of the character field of the class MyString.

5) The fifth function returns the character in the character field at the given index. And if Index is more than the length of the arr field, it through the IndexOutOfBoundsException.

You might be interested in
If Anyone can help me out that'll be great
morpeh [17]

Answer:Sorry but it shows 2 things only which doesn't tell us what u need help with.

Explanation:

6 0
3 years ago
To summarize means to
vredina [299]

Answer:

To summarize is to explain the main idea in as few words as possible. So the answer is the last statement, to "Condense the main idea into a few words". Hope this helped.

3 0
3 years ago
Read 2 more answers
Which of the following is considered a white collar crime?
irinina [24]

Answer:

The answer would be C if I am correct

Explanation:

The reason being is because white collar crimes are non-violent and usually are finance related and involves business or government things, so money laundering would make sense, i hope this helps

5 0
3 years ago
hello fellows i need a help.Ineed to know about computer evolutions and computer generations.please hurry.Its my rankover questi
mestny [16]

Answer: Computer generations: There was First Generation 50s,60s. 2nd  60s,70s, 3rd, 70s, Present, and 4th Future.

Computer evolutions: The first modern computer was created in the 1930s and was called the Z1, which was followed by large machinery that took up entire rooms. In the '60s, computers evolved from professional use to personal use, as the first personal computer was introduced to the public.

Explanation: This took me about 10 minutes. Enjoy.

8 0
2 years ago
What type of stud is placed below a windowsill to support its weight
Vesnalui [34]
A <span>cripple stud is what is use for windows and doors 

</span>
6 0
3 years ago
Other questions:
  • . Electricians will sometimes call ______ "disconnects" or a "disconnecting means."
    12·1 answer
  • Jessica has pinned her favorite applications as icons on her desktop. She always clicks on these icons to work on them. Which us
    10·1 answer
  • What keyboard shortcut keys selects cell A1
    12·1 answer
  • 40 POINTS PLZ HELP NEED ASAP!!!
    5·1 answer
  • Easy 25 points answer what is it called that you use only 1 and 0 like this 1010010011001100011110001010010101001010101010010101
    5·1 answer
  • Which of the following keys open the spelling and Grammer dialog box
    6·1 answer
  • PLEASE HELP! 2D Animation!
    12·1 answer
  • Choose the correct term to complete the sentence.
    12·1 answer
  • Explain how a magnetic hard disk drive (HDD) operates.
    12·1 answer
  • iv. Assuming the above operating system that cannot perform memory deallocation. Name at least three effects on the overall syst
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!