• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Java assistance

Painkillaz

Well-Known Member
May 8, 2010
190
15
Dallas Texas
Im currently taking Java (required class). My problem is...when I look at an example program (the code) I understand what each thing does and why it needs to be there...but when I go to write my own code I am completely useless:thinking:...I am a complete beginner...its a little ridiculous b/c my school makes the assumption that everybody took at least C++ in high school...anyways...what can I do to get past this hurdle...thanks in advance
 
i know how you feel mate trust me, i just finished a year in software development hoping to go onto computer science next year, ive been doing java for over a year now. They treat like you know it because they expect you to do study at home, i studied at home for hours on end. I can advise you buying some books maybe on java, or taking the online tutorials. But never lose your attention to your lecturer, always learn your abbreviations of terms so when he/she is talking you understand. Java is tricky at first but you will find yourself slowly melting into the language making it easier.

Just takes time and hard work, If you enjoy problem solving then it wont be that bad.
 
Upvote 0
Need a little more information. I just finished up my first Java class and it's not too bad for the lower level stuff.

JavaScript Tutorial

Maybe that site will help some.

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...
 
Upvote 0
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.
 
  • Like
Reactions: Painkillaz
Upvote 0
I agree with Zenze. I'm also a senior and he mentions some good tips.

I don't know how your teacher is handling your class, but you should try to do small projects implementing each concept. Murach's Java SE 6 book is pretty damn good in my opinion. Just keep trying. Once you get the hang of Java, other languages won't be much harder at all.
 
Upvote 0
CMPS Sophmore here..

Experience is key.. I love java at the moment.. Took java intro .. Found it is so much better than visual basic.. as much as other people at my school seem to hate java..

I took vis basic after java for the sake of comparison.. Lets just say.. I love java now.
 
Upvote 0
It takes time and effort to break through the wall of "I can understand simple example problems but can't reproduce them without assistance". When it happens to me it feels like I'm in a big museum with the lights out, and I'm bumping along with a little flashlight trying to see the big picture. When it finally clicks though it's like when Clark Griswold finally gets his Christmas lights to work.

Try typing the examples yourself into your editor. Don't copy/paste; do the typing yourself. Or, try actually writing the code with paper and pen. I've been playing with computers since I was 3 years old (and now I'm knocking on 30's door), but typing still seems sterile and mentally unconnected compared to dragging a pen across paper.
 
Upvote 0
thanks for all the advice...what is currently bugging me right now is our teacher will go over stuff in class, write programs with us in class...and then assign homework that has nothing to do with anything we have covered so far...for example...we have not had 1 JTextArea example in class...but for the homework that was due today we had to create a program which outputs a 3 column table using JTextArea....upon reaching the deadline to turn in the hw i just decided to add a bunch of spaces in my Strings to make it appear as a table...lets just hope he doesnt use any 4 digit numbers
 
Upvote 0
I took a Java class just last semester and I was in the exact same boat as you are. Does your school offer a CSE help lab? If they do you should go check them out, they seem to really help. The only way I survived that class is by getting help from a friend of mine who is a CSE major. I think an easier way to learn is to find someone who is familiar with the subject matter and ask them to help you with your homeworks. Don't let them do it for you, but ask them to guide you alone and give you a hand if you need any help. It was hard for me to learn anything from online tutorials so this is the route I took.

I hope it works out for you, but if it doesn't just remember that CSE isn't for everyone. I had taken Python before my Java class and I was just as lost in there and so after I survived Java I realized it wasn't the career for me. Don't feel like it's something you have to do if it really doesn't click because for some people it just doesn't. I'm deep into computers and tech but I never could quite catch on to the intricacies of coding and so I left CSE and switched majors.

I'm not sure if this really helps or not I just wanted to let you know that there's others in the same boat.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones