in java 1. Exercise Write a class called StringDemo. The class should …. a) use the JOptionPane to read in the sentence
Posted: Fri Jul 01, 2022 5:45 am
in java
1. Exercise Write a class called StringDemo.
The class should ….
a) use the JOptionPane to read in the sentence "I love learningJava Programming". Do not hard code it into your program.
b) print the length of the input string using the length()method in the String class
c) print the words "Java Programming" by using the substring()method with only one parameter
d) replace the word "Java" with "C++" in the input stringand print the result of this replacement
e) use only the substring() and concat() methods in theString class to print out the sentence : Java Programming is tolove learning The only two words you need to add are "is to". Theother words need to be taken from substringing the inputstring.
You may not use the concatenation operator ‘ + ’.
1. Exercise Write a class called StringDemo.
The class should ….
a) use the JOptionPane to read in the sentence "I love learningJava Programming". Do not hard code it into your program.
b) print the length of the input string using the length()method in the String class
c) print the words "Java Programming" by using the substring()method with only one parameter
d) replace the word "Java" with "C++" in the input stringand print the result of this replacement
e) use only the substring() and concat() methods in theString class to print out the sentence : Java Programming is tolove learning The only two words you need to add are "is to". Theother words need to be taken from substringing the inputstring.
You may not use the concatenation operator ‘ + ’.