Page 620 - ComputerScience_Class_11
P. 620

60           public static void main(String args[]) {
                61               Ddate ob = new Ddate();

                62               ob.accept();
                63               ob.find_day();
                64           }

                65       }

              The output of the preceding program is as follows:

                     BlueJ: Terminal Window - Java

                 Options

                Enter the Date in DD-MM-YYYY format : 25-12-2025
                Enter the Day of 1st January 2023 : Sunday
                Day as on 25-12-2025 is : THURSDAY



                Program 27     Write a program to remove lines containing the character 'a' from a text file.

                 1       import java.io.*;

                 2

                 3       class RemoveLinesWithCharacterA

                 4       {

                 5           public static void main(String args[]) throws IOException
                 6           {

                 7               String inputFile = "input.txt";

                 8               String outputFile = "output.txt";

                 9

                10            BufferedReader reader = new BufferedReader(new FileReader(inputFile));

                11

                12               System.out.println("Before:");
                13               String line;

                14               while ((line = reader.readLine()) != null)

                15               {

                16                   System.out.println(line);

                17               }






                  618  Touchpad Computer Science (Ver. 3.0)-XI
   615   616   617   618   619   620   621   622   623   624   625