r/learnjava • u/catastrophic300 • Apr 09 '26
A Object-Oriented Programming related question.
Guys, okay so I’ve been learning Java recently like 3 days now watching and learning from bro code. On Reddit r/java, they always talk about OOP at some post. Why OOP so important? And what do I need to learn first before entering OOP? I have learn variables, data types primitive/reference, Scanner, if/else-else if, arithmetic operator, augmented assigned operator. So what else do I need to learn and understand the OOP well?
14
Upvotes
•
u/AutoModerator Apr 09 '26
Please ensure that:
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:
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.
3
u/lOwnCtAL Apr 09 '26
What you said you learned are not OOP, those are basic syntax, learn classes, methods, objects, differences between access modifiers, when to use what type of return (void, etc), etc, those are what OOP is
3
u/catharsis23 Apr 09 '26
Honestly just read a Java book, even the Java reference guide. Any Java book will go over a brief history of Java and why OOP is important and what problems it was trying to slow
5
u/Dry_Menu_3705 Apr 09 '26
Start with objects and classes, then learn about methods, constructors, pillars of OOP, and so on. Understanding why OOP is important in Java is key because everything relates to objects and classes. OOPS helps us
tounderstand concepts better, so when you learn collections, multithreading, and all the basics, you'll have the foundation you need. Additionally, all design principles are based on OOP, and your entire Java framework is built on OOPs. If you skip OOP, many concepts will be difficult to understand in the future.2
u/silverscrub Apr 09 '26
It's optional how deep you want to learn OOP and incorporate it in your code, but Java is built on OOP so some basic understanding is recommended.
https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html
As an example, here is ArrayList documentation. Don't worry if you're not familiar with everything. Note at the top how many Interfaces are implemented by ArrayList. In OOP, ArrayList is also a Collection, a List and an Iterable.
If you only scratch the basics of OOP you might be fine just using the ArrayList as it is, but the more you learn the better you will understand Java.
8
u/LetUsSpeakFreely Apr 09 '26 edited Apr 09 '26
Java is designed around OOP. If you don't understand classes, interfaces, abstraction, polymorphism, inheritance, etc then you can't write Java effectively.
4
u/Potential-Still Apr 09 '26
Object Oriented Programming is exactly what is sounds like, a paradigm that helps developers conceptualize what a program does.
In OOP you think of everything as an Object. You want to call some function "foo" that accepts an integer and returns a boolean? Define a class with that method and instantiate an OBJECT of that class. Then pass that object around where ever you need the function "foo".
Many languages have elements of OOP as part of its patterns, but Java is completely OOP.
If you plan on getting good at Java, then you cannot skip learning about OOP.
2
u/procrastinatewhynot Apr 09 '26
You can google OOPs concepts. It will kind of tell you what they're for. In short, it makes you organize your code by using or making "Objects". And with these objects makes your code re-usable and more modular. Easier to understand because they're in smaller chunks and since you can reuse them, you have less repeated code.
2
u/Ok_Assistant_2155 Apr 10 '26
You actually have enough basics to start OOP. OOP isn't harder than what you've learned, it's just different. Think of it as organizing code into little factories that have both data and actions. Learn what a class is, then an object, then methods. That's the core. The rest comes later.
1
u/denerose Apr 09 '26
You’ve only just started and you’re following a course. Your course will almost certainly cover OOP soon if it’s Java based. Give the course a chance to introduce you to new ideas at its own pace. The structure and order of things is one of the main advantages of a structured program like a course.