I see a lot of people pass through beginning programming who have an idea of something they want to do, usually writing a game, but they barely get off the ground because they don't know the basics. They fail to launch, get discouraged, and quit, usually repeating the cycle several times.
Maybe you already know the basics (variables, assignments, program control - looping and branching - arrays, I/O, basic data structures, etc.) in another language and would like to translate that knowledge to Java but don't know how or don't have the patience to study the basics all over again. I don't know, you didn't say.
Whatever your story, you need to really learn the basics in Java, and you need to do it in an ordered way with lots of practice along the way. Get a book - there are several free e-books available - start at page 1. Read every word, write every example program and do every exercise until they compile and run correctly, and then modify them until you understand absolutely everything there is to know about them and the programming tools and concepts they present. Do it because you're curious, want to learn and understand how it all works, and because you love programming. If that's not your motivation, then ask yourself now why you're here.
Done correctly, within 4 to 6 months, depending on how hard you work and how much you practice, you'll be confident about imports, know when to extend and when not to, will be able to write a correct main() method in your sleep, will know when to write a method and whether it should be static or not, etc. This knowledge will come to you with study and practice, practice, and more practice.
There's no magic, no shortcuts, no Vulcan mind meld to squirt the knowledge into your head. There's just hard work that you do eagerly, because you love it and want to know.
Now find a book and get to work. Come back when you need help with anything.