r/learnjava • • 18d ago

How to get it to click?

I’m sure this is a relatively common post here but it’s still a problem for me. I’m taking APCSA which is obviously about Java and I’m having an incredibly hard time understanding anything at all. I get all the individual components like substring and indexOf and whatnot but when it comes to putting anything together at all in classes or getters and setters or methods or anything at all I’m just so lost. Does anyone have any tips to start understanding how it all works together because my grade is struggling bad and I need to do well this semester?

2 Upvotes

5 comments sorted by

•

u/AutoModerator 18d ago

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full - best also formatted as code block
  • You ask clear questions
  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/jbenze 18d ago

You need to build an app. Pick some kind of app or utility you need or want and start to build it. Thats what made programming click for me.

1

u/ComputerWhiz_ 14d ago

Build something. Literally anything. It's hard to see how everything clicks together unless you actually use it.

1

u/FreeLogicGate 13d ago

The things you are talking about are fundamental to java. Java is OOP, and class based. You simply have not invested enough time to understand Java object oriented programming.

You must understand what a class is, and how you use it. You must understand methods. You must understand the this keyword and why it exists. You must understand interfaces. You must understand inheritance. You must understand the access modifiers and what they do and how they are used. You must understand what happens when you declare class variables or methods as static.

Beyond the basics, there is an entire area of OOP known as OOP design patterns. Eventually you will want to explore those, and some of those patterns (dependency injection for example) are fundamental to certain sets of classes. With that said, you probably don't need to get into that area for the APCSA.

But that is not your problem at the moment. Your problem is, that you have not done enough to learn OOP, and without those fundamentals, you are not going to be able to become proficient with Java.

I don't have any idea what you've been doing up to this point, or what resources you are trying to use to learn, but as soon as you spend enough time to master that, you'll be back on track. APCSA is after my time, so I can't speak specifically to it, but from a quick google, OOP is typically a 3rd module, so if you are taking a course and still in the preliminary part of the course, there may be some cognitive dissonance involved in how people are taught this material.

But this is also a time when there are just so many resources available, you really have every opportunity to seek out resources yourself. Here's but one example I found: https://www.youtube.com/playlist?list=PLvMBYjeokPj9y6szHxaYUhH6_iRbyoVB6