I was in your exact position once. About a year ago I started Java 101 for my Computer Science degree. I was lost in regards to every aspect of programming, and subsequently failed the midterm exam. However by the end of the semester I had an A- in the course.
Here's some advice if you decide to continue trying to code.
>Always write the code
It's nice to look at the teacher's power points, but at the end of the day you're never going to understand code just looking at it, you've got to get down and dirty with it to really understand it.
>Don't get overwhelmed by the entire program, take it method by method, piece by piece.
You have to assume a certain mindset while programming. You don't take a problem as a whole, you break it down into manageable pieces and solve it. When trying to understand a problem, don't let your eyes glaze over the method, start from the arguments and work your way bit by bit to the end. Look for patterns, when you find one you can duplicate it and have a significant part of the program or method written in no time at all.
>Learn from your fellow students as well as your teachers
I've learned just as much from my fellow students, if not more, about code than my teachers. Having to explain a program to a struggling friend or having a program explained to you in simple, easy to understand terms helps immensely. Don't be afraid to make friends with some of the CS majors in your class, they'll make life a lot easier for you.
>While coding look for shortcuts.
As previously stated in this thread, a good programmer is a lazy programmer. Don't write
>return int a=3;
Find ways to make your life easier, that's the secret to good efficient programming.
All that aside I'd be happy to help you out with whatever you're on! A few questions first:
>What topics are you studying in class/previously covered?
>What IDE (Netbeans, BlueJ, Eclipse, etc.) are you using to program?
Just post your code to pastebin.com and post it here and I, and maybe a few people who've previously posted ITT, will help you out. If you have any general questions (Data types, arrays, sorts, methods, syntax, etc.) then ask away. Don't give up just yet, it's hard at first but after the initial plunge it's all easy.