Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication2;
- import java.io.*;
- public class JavaApplication2 {
- public static boolean czypal(String a)
- {
- for (int i=0,j=a.length()-1;i<j;i++,j--)
- {
- if (a.charAt(i)!=a.charAt(j))
- return false;
- }
- return true;
- }
- public static void main(String[] args) throws IOException {
- BufferedReader odczyt = new BufferedReader(new FileReader("dane.txt"));
- String linia;
- for (int i=0;i<10;i++)
- {
- linia=odczyt.readLine();
- System.out.println(linia+" "+czypal(linia));
- }
- odczyt.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement