This is a little hard to explain, but here goes nothing. I am creating a program that creates excuses for example:
"I am sorry, but my dog ate my homework!"
The way I'll make it random is by placing the intros "I am sorry but" in a text file on it's own line, and then do the same to the culprits "my dog", and the reasons "ate my homework!". I would like to know how to make a variable equal to the line of one of the files. I did this for another program, this one created random Shakespearean insults, but I did it in python. The way I did it was:
adjective = random.choice(open('/filepath*', 'r').readlines()).strip()
I would like to do the same but in Java, but I am at a loss as to how. Any suggestions? ( I would prefer something that can be done in a single line like in python)
Thakns for the help.