I dealt with massive imposter syndrome throughout my entire time in college IT courses. It truly felt like every other person in the class had some kind of extensive background already in tech and that I was just slow and not made out for the material.
I'm only at the level of Desktop Support currently, but what I can tell you is that working in IT is not about knowing the answer to everything immediately, but rather being able to investigate, research, and resolve issues as they are presented to you.
Not sure whether you're a CS major intending to become a programmer, or an IT related major who is taking a required Java course. For what it's worth, Java was one of the most stressful courses of my Information Systems degree. A lot of people at my school would say Java 1 and 2 were the classes to weed out those who weren't serious about the degree path.
If you're going through a Computer Science program, then this Java program is probably only the beginning of the level of difficulty you will be handed. Not saying this to be discouraging but CS is a different beast than what I went through as an Information Systems undergrad, granted I've always been shit at Math which is what threw me off that path pretty quickly.