Stephen is initially shown as having an active fantasy life regarding sex but limited actual experience, which he then gains. In contrast, his religious education and related social values are a constant presence; while not fully repressing his sexual attitudes and activity, they promote inner torment which he tries to assuage.
In Chapter 2, for example, after Stephen admires Lord Byron’s poetry, his classmates beat him up because Byron is a heretic. As he wanders the streets thinking about women and sex, his thoughts seem real, but later it is revealed that he has his initial sexual experience with a prostitute. In the next chapter, the reader learns that visiting brothels has become a habit, but he goes to church and participates in a sodality (religious organization). Attending a religious retreat and later listening to a sermon, he internally faces the hypocrisy of his position and decides to repent and rehabilitate himself, in part to make himself worthy of Emma, the girl he likes. While out on the streets, worrying about his soul, he finds a chapel, confesses to the priest, and prays, thereby gaining a measure of inner peace.