File in a static block

  • 8
Initialize the variable Statics.FILE_NAME to the full path to a data file that contains several lines. Then, in the static block, read all the lines from the file named Statics.FILE_NAME, and add them separately to the List lines.
You can't complete this task, because you're not signed in.
Comments (6)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
DarthGizka
Level 24 , Wittenberg, Germany
4 June, 21:11
task1525 (File in a static block) caveat: keep it simple and use a fixed filename like "c:/Windows/win.ini", which worked for me. Farting around with System.getenv, Paths and so on in order to use the moral equivalent of "%windir%/win.ini" and "%JAVA_HOME%/COPYRIGHT" worked only when testing (i.e. running the Solution class) but failed during verification because then the files were not found. No idea why ...
Kent Hervey
Level 16 , United States
16 April, 22:59
This task has the lowest number of "completed by <<>> students of any task I have encountered so far. That may change tomorrow as maybe lots of people will decide to do this one, but it perplexes me, it is a good task and certainly possible.
Baurzhan Konurbayev
Level 40 , United States
9 August 2020, 21:56
Static section for file reading is expected in Solution class.
Thomas Sixberry
Level 16 , Rochester Hills, United States
15 February 2020, 17:48
What does "to the full path to a data file" mean? ٩(´•⌢•` )۶⁼³₌₃
Roman Grygorczuk
Level 19 , Cracow, Poland
30 December 2020, 13:07
For instance "C:/Users/USER_NAME/Documents/CodeGymTasks/2.JavaCore/src/com/codegym/task/task15/task1525/test.txt"
senthamil
Level 18 , Korampallam, India
9 July 2019, 06:32
what should i put for file path