Last Lord's Day John Piper preached a message on John 3:16-21, titled, "This Is the Judgment: Light Has Come into the World." His focus was upon 3:19-21. You may watch a video of the sermon here. Locate the portion to which I refer at minute 31:37. The video presentation is fuller than the manuscript version.
Among the various significant things John addressed, one that stood out is his clarification that we must not confuse behavior done "in the light" with behavior done in "public."
Jesus is not saying that no sins happen in public. Many people flaunt their sins in public. But they only do this where the light of Christ is so banished that they can get approval from the people that matter to them. In other words, where darkness abounds publicly, you can sin publicly without coming into the light.
Here is a transcript from the video portion I link above.
If it is so terrifying to come into the light, why are sins so publicly flaunted in our day? There’s a real simple reason. As long as the public banishes the light, there are enough people to admire the sinful behavior that you don’t feel ashamed but approval. As long as the light of Christ is kept out of the sphere in which you are acting out your evil, public sin is in the dark. Public doesn’t mean light. Public means dark people observing dark behavior and liking it because it confirms their own.
John Piper's distinction is quite crucial. As our society persists in defining sin downward (cf. Moynihan's Defining Deviancy Down), sinful behavior becomes increasingly mainstreamed and approved. All kinds of sinful behavior formerly done under the cloak of darkness or privacy have now fully emerged from the closet and from secrecy. Consider any kind of sinful behavior, such as, premarital sexual engagement, sexual immorality, lying, falsifying testimony, gossiping, etc. Sufficiently large enough numbers of people approve of these and of many other sinful practices so that there is no longer any shame attached to doing these openly and publicly.
Hence, we must not confuse the light and darkness, of which John 3:19-21 speaks, with public and private respectively. Light and darkness are not at all the same as public and private.