Savitribai Phule Pune University T.Y.B.B.A.(C.A.) Core Java Pratical Slip 1 Answers

Write a ‘java’ program to display

Slip 1 A) Write a ‘java’ program to display characters from ‘A’ to ‘Z’.

Answer :

class slip1A{

    public static void main(String args[]){

      for(int i=65; i<=90; i++){

        System.out.print( " " + Character. toString((char) i));

      }

    }

}

Output :




Slip 1 B) Write a ‘java’ program to copy only non-numeric data from one file to another file.

Answer :

import java.io.*;

class Slip1B{

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

        char ch;

        FileReader fr = new FileReader("a.txt");

        FileWriter fw = new FileWriter("b.txt");

        int c;

        while ((c=fr.read())!=-1){

            ch=(char)c;

          if(Character.isDigit(ch)==false){

              fw.write(c);

          }

        }

        fr.close();

        fw.close();

    }

}

Output :

Savitribai Phule Pune University T.Y.B.B.A.(C.A.) Core Java Pratical Slip 1 Answers Savitribai Phule Pune University T.Y.B.B.A.(C.A.) Core Java Pratical Slip 1 Answers Reviewed by technical_saurabh on December 29, 2021 Rating: 5

No comments:

Powered by Blogger.