CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS J2EE JAVA DETAILS
Question :
Write a java standalone program / method to take out all the special
characters in the string provided below.
//ASCII a ? z (97 ? 122)
String sSENTENCE = ?This!is^a$t*e)s|t?;


Posted by: chanti on 5/19/2008

Contact chanti  Contact chanti
Category Java Interview Questions
Rating (0.0) By 0 users
Added on 5/19/2008
Views 497
Rate it!
Answers:

class avoisSpecialChar
{
public static void main( String ar[] )
{
String realSentence = "This! is^ a$ t*e)s|t";
String specialChars = "", chars = "";
for ( int i = 0; i < realSentence.length(); i++ )
{
if ( Character.isLetterOrDigit( realSentence.charAt( i ) ) || Character.isSpaceChar( realSentence.charAt( i ) ) )
chars = chars + realSentence.charAt( i );
else
specialChars = specialChars + realSentence.charAt( i );
}
System.out.println( "chars " + chars );
System.out.println( "specialChars " + specialChars );
}
}



 Posted by: Muthumari    

Contact Muthumari  Contact Muthumari


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
Why pointers are not used in java?
View Answer
What is super class of an Exception class?
View Answer
What is super class of an Exception class?
View Answer
Why JAVA not support multiple inheritance? How can we pass address of an object?
View Answer
In How many ways we can request the System for the garbage collection to cleanup the memory? And what are the differences?
View Answer
Why java is not pure object oriented language?
View Answer
what is the definition of arraylist? plz write in brief.
View Answer
1)What are the actual functions of JVM?
2)When to use a class and when to use
an Abstract class?
3)what is the use of constructors other than creation of objects?
4)when to use constructors?
5)when to use Interface?
6)why java does not support pointers?
7)why multiple inheritance is not possible in java without using Interfaces?
View Answer
Why we have used to in main method in JAVA this words
1)public
2)static
3)void
4)main
5)(String args[])
View Answer
Addition of two numbers using Bitwise operators.
Reading An 2D array using single for loop
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL Java Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/13434/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.72