Posts

Showing posts with the label palindrome

Iterating though a text file in Java so that each line has information about that line

Iterating though a text file in Java so that each line has information about that line Ok, so I really didn't know how to say it right for the title so this should shed some light on the situation. I'm making a palindrome program in Java. In every which way you look at it, it works just fine. It reads in a file using Scanner , searches through the entire file and outputs if that line in the text file is a palindrome. If you have any special characters or caps it deletes them and turns everything to lowercase. Scanner My issue is that after the check is done on each line, I want to show some extra information next to the result. Each line should show how many words are in the line, how many characters and if its a palindrome or not. Anyway here is the code, hopefully someone can help me figure this out. Thanks. import java.io.File; import java.util.Scanner; public class Palindrome { public static void main(String args) { //Global Variables Scanner cScan = nul...