Write a class named CharArray that has the following field:
1. myCharArray. The myCharArray field is a character array.
In addition, the class should have the following constructor and other methods.
• Constructor: The constructor should accept the char array as arguments
• swapFirstAndLast: The swapFirstAndLast method should swap the first element with the
last element in the array.
• DisplayArray: The DisplayArray method should display the characters in the array.
• DispalyString: The DispalyString method should display the char elements as a string word
in the array.
1
Comments
Leave a comment