How to use split function in spak scala : I am supplying line by line to the program and each line consists of date in the format MM/DD/YYYY,how i can use split function here.

    val data= line.split("/")
    val year = data[2]
     println(year)

I am not getting any output can anyone explain me where I am wrong.