Jesus had been preaching for almost a week in the temple before sitting down and eating Passover with His disciples. I am sure the current teachings of Jesus they heard during the week of were still lingering in the their minds.
The setting: Judas had left the room and Peter had been warned of his upcoming betrayals when Jesus begins to encourage the disciples. This is the setting when Jesus says these words,
“I am the true vine, and My Father is the vinedresser. Every branch in Me that does not bear fruit He takes away; and every branch that bears fruit He prunes, that it may bear more fruit. You are already clean because of the word which I have spoken to you. Abide in Me, and I in you. As the branch cannot bear fruit of itself, unless it abides in the vine, neither can you, unless you abide in Me. I am the vine, you are the branches. He who abides in Me, and I in him, bears much fruit; for without Me you can do nothing.”
- John 15:1-5 NKJV