IN JAVA
HW4_P2 - MyString
The String class is provided in the Java library. Provide your own...
Computers and Technology, 13.10.2020 04:01 tiny2007
IN JAVA
HW4_P2 - MyString
The String class is provided in the Java library. Provide your own implementation for the following methods (name the new class MyString):
**DO NOT USE THE STRING OBJECT AND ITS METHODS. IMPLEMENT THEM ALL AGAIN YOURSELF!
**You can use char[] and Character object.
public MyString(char[] chars);
public char charAt(int index);
public int length();
public MyString substring(int begin, int end);
public MyString toLowerCase();
public boolean equals(MyString s);
public static MyString valueOf(int i);
public char[] toChars();
Use the following class driver with no modifications to it!
import java. util.*;
import java. lang.*;
import java. io.*;
class DriverMain{
public static void main(String[] args) {
MyString s1 = new MyString(new char[] {'A', 'B', 'C'});
System. out. println(s1.length());
System. out. println(s1.charAt(1));
MyString s2 = s1.substring(0,2);
System. out. println(s2.toLowerCase().equals(new MyString(new char[] {'a', 'b'})));
char[] chars = MyString. valueOf(345).toChars();
for (int i = 0; i < chars. length; i++) {
System. out. print(chars[i]);
}
}
}
---And use the following class that was refered to in main
class MyString {
public MyString(char[] chars){
}
public char charAt(int index){
}
public int length(){
}
public MyString substring(int begin, int end){
}
public MyString toLowerCase(){
}
public boolean equals(MyString s){
}
public static MyString valueOf(int i){
}
public char[] toChars(){
}
}
PLEASE follow the instructions that are provided and comment the code so I can understand it better!. I'm really confused about this assignment and need as much help as possible!
Answers: 1
Computers and Technology, 22.06.2019 08:00
Someone with this coz i donāt really know what i can choose, just pick whatever u want. homework - you need to choose a website that you like or use frequently. you must visit the website and discuss 6 different features/parts/aspects of the website that you think makes it good. (100 words)
Answers: 2
Computers and Technology, 22.06.2019 11:00
How does a policy manual an organization? a. it boost productivity. b. it create awareness in employees about the organizationās values. c. it employees achieve targets. d. it safeguards the organization from liabilities.
Answers: 1
Computers and Technology, 23.06.2019 03:30
Hashtags serve to identify the topic of a given tweet true false
Answers: 2
Computers and Technology, 23.06.2019 12:00
If you're using an existing powerpoint presentation that will receive new slides based on a word outline, select the a. slide that will appear after the new slides. b. first slide in the presentation. c. slide that will appear before the new slides. d. last slide in the presentation.
Answers: 2
Social Studies, 16.07.2019 09:30
Chemistry, 16.07.2019 09:30
Social Studies, 16.07.2019 09:30
Social Studies, 16.07.2019 09:30