file6 = File.new("C:\\Ruby\\Sample")str=file6.getsputs str# In this code, the file6.gets statement will pass the contents of the file Sample to the str variable. The puts str statement will output the contents to the screen.