Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Plz help with third Question
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


alhisnawy
Plz help with third Question
1 Answer(s)      4 years and 10 months ago
Posted in : Java Beginners


1)-
Specify and implement a procedure that determines whether or not a string is a palindrome. (A palindrome reads the same backward and forward; an example is "deed.")
-----------------------------------------------------------
2)-
Implement a standalone procedure to read in a file containing words and white space and produce a compressed version of the file in an output hie. The compressed version should contain all of the words in the input file and none

Advertisement
View Answers

February 15, 2010 at 4:52 PM


Hi Friend,

1)
import java.io.*;
class Program{
public static void main(String[] args) throws Exception{
System.out.print("Enter String:");
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String input = reader.readLine();
String st[]=input.split("");
String reversedString="";
for(int i = st.length-1; i >= 0; i--){
reversedString+=st[i];
}
if(input.equalsIgnoreCase(reversedString)){
System.out.println("String is Palindrome");
}
else{
System.out.println("String is not a Palindrome");
}
}
}

2)
import java.io.*;
import java.util.regex.*;

public class Read {
public static void main(String[] args) throws Exception {

BufferedReader bf = new BufferedReader(new FileReader("C:\\file.txt"));
String line;
String data = "";
while ((line = bf.readLine()) != null) {
String replacedData = line.replaceAll("[|,|:|/|\\|\'><*}{^();]"," ");
System.out.println(replacedData);
}
}
}

Thanks


Related Tutorials/Questions & Answers:
Plz help with third Question - Java Beginners
Plz help with third Question  1)- Specify and implement a procedure that determines whether or not a string is a palindrome. (A palindrome reads the same backward and forward; an example is "deed
plz help me for this question
plz help me for this question  Apply simplex procedure to solve the L.P.P. maximize z = 3x1 + 4x2 subject to 5x1 + 4x2 ? 200; 3x1 + 5x2 ? 150; 5x1 + 4x2 ? 100; 8x1 + 4x2 ?? 80, x1 ? 0, x2 ? 0
Advertisements
plz help meto solve this question
plz help meto solve this question  for a file that exist what will be the length() method in the file class return
interview question plz help me and thers
interview question plz help me and thers  A college is good if it satisfies the following conditions: 1.Its number of students is greater than 1000. 2.If the name ends wih a character 'e', then it should not start with character
Plz help me with this Question - Java Beginners
Plz help me with this Question  this is java code ------------------------- Consider the following code: int [ ] a = [1, 2, 3]; Object o ="123"; String t = "12"; String w = t + "3"; Boolean b = o.equals (a); Boolean b2
PLZ Need some help on the 2nd part of this question...Someone please help !!!!
PLZ Need some help on the 2nd part of this question...Someone please help !!!!  write an application that displays a menue of three items... a third time.if the user types 0 to quit,display the total cost of the two items
sir i,have a assignment for these question plz help me sir - JavaMail
sir i,have a assignment for these question plz help me sir   1.Design a Java interface for ADT Stack. Develop two different classes that implement this interface, one using array and the other using linked-list. Provide
Plz Help
Plz Help  Hello Guys!! Plz. Help I need to write a program to display the astrological sign based on your birthday for example If we enter the date of birth in the following format from console--13/08/1990 it should give you
plz help
plz help  what is the procedure and code to design an interactive GUI in java using swings
sir i,have a another assignment for these question plz help me sir - JavaMail
sir i,have a another assignment for these question plz help me sir  1. Design classes for Currency, Rupee, and Dollar. Write a program... to both. plz help me sir
ArrayList question plz solve it
ArrayList question plz solve it  An arraylist object stores an Emp Object, where there is name,age,address of the employee is stored, And i want to access the data in the basis of age based? Provide answer to the question
Help me quickly plz??
Help me quickly plz??  Can you help me to write code quickly this code is a java code take input as double and should use command line arguments and enhanced for statement then find the combine of the numbers plz help quickly
java coding help plz ?
java coding help plz ?  Given two integers N and M (N â?¤ M), output all the prime numbers between N and M inclusive, one per line. N and M will be positive integers less than or equal to 1,000,000,000. The difference
Gui plz help
Gui plz help   Create a Java application that would allow a person to practice math (either addition, subtraction, multiplication or division). The questions must be randomly generated ( the values for each number should
Plz Help Me
Plz Help Me  Write a program for traffic light tool to manage time giving between Main-Street and sub-Street. firstly, give green light for 40... traffic light on the frame. We have used java swing. It may help you. import
plz help - Java Beginners
plz help  i have to programs and it takes too long to run them so i got a solution that makes programs run much faster which is threading programming.. but i dont know how to aplly that on my 2 programs: the first code
plz help me find a program
plz help me find a program  plz help..i want a source code in jsp for order processing
plz help me - Java Beginners
plz help me  Deepak I can write a sessioon code plz help me admin_home.jsp page is display but data is not disply plz help me what is wrong
plz help me - Java Beginners
plz help me  Hi, I want to search all field from database using name, and display in text box, then data is update and delete. i want to search name using alphabets a-z, plz reply fast. plz help me this is very urgent
plz Help me - Java Beginners
plz Help me  Hi, I want learn struts,I dont have any idea about this plz help how can i make a framework.If u have any information then plz send my personal id plz tell me that whose software installed.and give me brief
plz help me today plz plz - Java Interview Questions
plz help me today plz plz  2.) Suppose list is an array of six elements of type int. What is stored in list after the following java code executes? . for (i = 0; i < 5; i++) { list[i] = 2 * i + 5
plz help me - Java Beginners
plz help me  deepak hw can i create a data grid in jsp and also how can i connect to the data base plz help me  to create data grid in jsp use html tables with borders. to connect to data base use scriptlets. ex
Plz give me code for this question
Plz give me code for this question  Program to find depth of the file in a directory and list all files those are having more number of parent directories
plz help me - Java Beginners
plz help me  Thanks deepak continue response..i face some problem i hv a these file index.jsp,sessionvalid.jsp, both r store in project folder... is true...but i very confuse that how it is not displayed admin page plz any one
plz help me!!!!!!!! - JSP-Servlet
plz help me!!!!!!!!  i`ve set the environment varaibles for tomcat as well as jdk.. but i`m not understanding where i`ve to save my servlet..i.e.... there are compilation errors.. plz do help me.   make sure that you did
help plz - Java Interview Questions
, if the input string is abcd, the output is : edcba plz plz plz plz plz help...help plz  1 )write a program that does the following : a. prompts the user to input five decimal numbers representing the scores? b. prints
i need help plz .... Quickly
i need help plz .... Quickly   how can i count how many numbers enterd by the user so the output would be like this Total number of Scores = .... this is my code :- import java.util.Scanner; public class SCORES { public
help plz - Java Interview Questions
help plz   1 )write a program that does the following : a. prompts the user to input five decimal numbers representing the scores? b. prints the five decimal numbers? c. converts each decimal number to the nearest integer? d
plz help - Java Interview Questions
plz help  1)write a java program that prompts the user to input a decimal number and print the number rounded to the nearest integer? 2)write aprogram that prompts the user to input the five decimal numbers representing scors
PLZ Need some help JAVA...HELP !!
PLZ Need some help JAVA...HELP !!  Create a class names Purchase Each purchase contains an invoice number, amount of sale and amount of sales tax. Include set methods for the invoice number and sale amount. Within the set
Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems
Advertisements
 

 

 

DMCA.com