Its an intro to java class, we arent doing javascript...so far we've gone over from the very basic System.out.println("welcome"); program to while, dowhile, switches, if else...like i said when i see it i understand it but if someone were to give me a problem that they needed a program for and if i wasn't able to use anything except memory or even with a book I cant/dont know where to begin, when to write what, etc...
I might be able to provide some insight, but unfortunately probably not much help. I'm in my senior year of a computer engineering degree. I did some java in high school, however the problem that you are experiencing is not specific to any language.
The problem is not understanding syntax you seem to be able to do that just fine. The problem is using the syntax that you understand to accomplish your goal, and thats the harder part unfortunately (at least it was for me). Learning a programming language was one of the first times that I experienced something where I had to
create the steps to solve a problem instead of just following instructions. In programming unfortunately (or fortunately) every problem is unique and there are a endless amount of ways that you can code your program to achieve its goal (some more efficient than others obviously). It honestly has a lot to do with being creative.
Unfortunately I must say that the only way to get good at it is experience with a language. As you code more programs and encounter new problems/situations you will develop certain "strategies" that you can use to move you toward your goal. Its not really something that can just be explained, you must create, use, and employ it for yourself.
However something that I learned early on was to divide and conquer. Breaking down the main goal into a set of subgoals, even without knowing how you are going to accomplish those subgoals is very helpful, at least to me. Then you can further break down those subgoals into smaller goals, just continuing the cycle until you have a bunch of small, easily to accomplish goals. IE if I have a particular goal that I want to accomplish I would make a method/function/whatever to do that. Then that would be broken down farther with other methods/functions/whatever. A lot of the time I will just write out the names of these with comments about what they will do and actually figure out the code and other methods I will need later. Formally this is know as "top down" programming.
There is also "bottom up" programming where you just write a bunch of functions that you think you will need and combine them together to build the program up. The best method to use depends on the problem you are facing and how you think about things, however I generally find "top down" to be better in most situations.
Sorry if I went off on a tangent but it really just takes time/experience but once you get it things will become much easier. This is why they say that learning your first language is always the hardest. Picking up languages after that is easy because most of the strategies that you already learned still apply you just have to use a new syntax.