Which method you will use to create a new file to store some log data. Each time a new log entry is necessary, write string to the file in java ?



Which method you will use to create a new file to store some log data. Each time a new log entry is ..

Answer / Mayank Rastogi

In Java, you can create a new file using `FileOutputStream` and write strings into it using various methods like `println()`, `write()`, or `print()`. For logging purposes, consider using Log4j, Slf4j, or java.util.logging.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What are three types of loops in java?

1 Answers  


What is the difference between this() and super() in java?

1 Answers  


What are the override methods in Object class?

2 Answers   Tech Mahindra, Wipro,


How to provide security in java

1 Answers   Infosys, TCS, Tech Mahindra,


Is string thread safe in java?

1 Answers  


Why webdriver is an interface?

1 Answers  


What happens if an exception is not caught?

6 Answers   Amazon,


how many access specifiers are available in java

11 Answers  


Can we assign the reference to this variable?

1 Answers  


What is persistence ?

2 Answers  


What is illegal identifier in java?

1 Answers  


Which java ide is used the most?

1 Answers  


Categories