The answer to this question is given in the previous chapter where Jesus discusses the same topic.
John 5:24-29 - 24 Truly, truly, I tell you, whoever hears My word
and believes Him who sent Me has eternal life and will not come
under judgment. Indeed, he has crossed over from death to life.
25 Truly, truly, I tell you, the hour is coming and has now come when the dead will hear the voice of the Son of God, and those who
hear will live. 26 For as the Father has life in Himself, so also
He has granted the Son to have life in Himself. 27 And He has
given Him authority to execute judgment, because He is the Son of Man.
28 Do not be amazed at this, for the hour is coming when all who are in their graves will hear His voice 29 and come out—those who
have done good to the resurrection of life, and those who have done
evil to the resurrection of damnation.
We have other material on the same topic:
1 John 5:11, 12 - And this is that testimony: God has given us eternal
life, and this life is in His Son. Whoever has the Son has life;
whoever does not have the Son of God does not have life.
Dan 12:1, 2 - “At that time Michael, the great prince who stands watch
over your people, will rise up. There will be a time of distress, the
likes of which will not have occurred from the beginning of nations
until that time. But at that time your people—everyone whose name is
found written in the book—will be delivered.
And many who sleep in the dust of the earth will awake, some to
everlasting life, but others to shame and everlasting contempt.
Rev 11:18 - The nations were enraged, and Your wrath has come. The
time has come to judge the dead and to reward Your servants the
prophets, as well as the saints and those who fear Your name, both
small and great— and to destroy those who destroy the earth.”
This is entirely consistent with Jesus' teaching about the great eschatological resurrection as recorded in John 6:39, 40, 44 -
And this is the will of Him who sent Me, that I shall lose none of
those He has given Me, but raise them up at the last day. For it is My
Father’s will that everyone who looks to the Son and believes in Him
shall have eternal life, and I will raise him up at the last day.” ...
“No one can come to Me unless the Father who sent Me draws him, and I
will raise him up at the last day.
Thus, while righteous faithful will be raised at the last day to be with God forever, the wicked will be raised to be eternally condemned.
1 John 2:17 - The world is passing away, along with its desires; but
whoever does the will of God remains forever.
2 Peter 3:13 - But in keeping with God’s promise, we are looking
forward to a new heaven and a new earth, where righteousness dwells.
Rev 22:3-5 - No longer will there be any curse. The throne of God and
of the Lamb will be within the city, and His servants will worship
Him. They will see His face, and His name will be on their foreheads.
There will be no more night in the city, and they will have no need
for the light of a lamp or of the sun. For the Lord God will shine on
them, and they will reign forever and ever.