Menu
Question Index
...

What will be the output of following program?

import java.io.*;
import java.util.*;

public class BlackAndWhite {

    public static void main(String[] args) throws Exception {
        Properties p = new Properties();
        p.setProperty("email", "************@gmail.com");
        p.setProperty("name", "Oleti Kiran Kumar");
        p.store(new FileWriter("oleti.properties"), "Properties Example Program");
        BufferedReader br = new BufferedReader(new FileReader("oleti.properties"));
        String line = null;
        int i = 1;
        while ((line = br.readLine()) != null) {
            if (i != 2)
                System.out.println(line);
            i++;
        }
    }
}


#Properties Example Program
name=Oleti Kiran Kumar
email=************@gmail.com
#Properties Example Program
email=************@gmail.com
#Properties Example Program
name=Oleti Kiran Kumar
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: BufferedReader In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App