• Post Reply Bookmark Topic Watch Topic
  • New Topic

need help  RSS feed

 
Kim Nana
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone ..
Please can you help me in these question :

*Given a string s ,write statements to do the following:
a. Extract the middle character and save it in variable ch.
b. Print the character before the last character.
c. Print the string that is formed by deleting the first and last
characters of s.
d. Print the string that is formed when the string "mid" is inserted in
the middle of s.
e. Print the location of the third occurrence of the character 'e' in s.

* Write statements that convert the middle character in a string str to its
corresponding lower case equivalent and prints the resulting string.

*Find the errors in the following program:
public class Errors {
public static void main( String args[] ) {
int x , y,z;
String str1 , str2;
double a , b;
x = y;
str1 = "Java is Enjoyable";
y = indexOf('P');
z=str2.CharAt(6);
str1= str2.substring( x , x-1 );
str2=str1.replace(str1,”Damaged”);
}
}

 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what help do you need? Nobody here will do it for you, but we are happy to help by answering SPECIFIC questions.
 
Tyson Lindner
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
look up String for the first question to find the appropriate methods.
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please show us how far you have got already.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!