How to Read File Content in Scala

Read File Content in Scala

In this example, we will show you about how to read file content in scala program language. The example were tested with environment and attached in the post.

Example Code


object ReadFile {
	def main(args: Array[String]) {
		var file = new File("abc.txt");
		var fileReader = new FileReader(file);

		var data =;
		while(data != -1) {
			data =;

Input File

How to Read a File Content in Scala


Hello everyone, This is Dinesh Krishnan

Hello, folks, I am a founder of I love Java and Open source technologies, If you find my tutorials are useful, please consider making donations to these charities.