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, 23.06.2019 21:40
language consists of basic components, and they are called a. 3; mental images, concepts, and speech b. 2; language acquisition and linguistic relativity c. 3; heuristics, algorithms, and analogies d. 4; phonemes, morphemes, syntax, and semantics e. 2; words and grammar
Answers: 3
Computers and Technology, 24.06.2019 10:00
Each time you save a document, you will need to type in the file type in which it should be saved you can select the save button to save it with the same file name if it has been previously saved you will need to select the location to save the file you will need to use the save as dialog box
Answers: 1
Computers and Technology, 24.06.2019 22:30
In writing a paper for his english class, gavin quoted an author of the book. what should he include in his paper to credit the source? citation caption header entry
Answers: 1
Mathematics, 26.11.2019 20:31
English, 26.11.2019 20:31
Social Studies, 26.11.2019 20:31
History, 26.11.2019 20:31
Physics, 26.11.2019 20:31
History, 26.11.2019 20:31
English, 26.11.2019 20:31
History, 26.11.2019 20:31
Mathematics, 26.11.2019 20:31
Mathematics, 26.11.2019 20:31
Computers and Technology, 26.11.2019 20:31