Object Oriented Programming in Java with IntelliJ Part 2
Hello, everyone!
I'd like to share about what is and how to code object oriented programming in Java language with IntelliJ.
What is Java?
Java is a computer programming language and computing platform.
What is IntelliJ?
IntelliJ is an IDE created that make possible for us to code or develop something useful for people.
What is IDE?
IDE is an Integrated Development Environment that means provide the basic tool for developers to code and test the software. Basicly, it will contain code editor, compiler and debugger.
What is OOP?
OOP stands for Object Oriented Programming. OOP is a programming concept which applies object concept that the object is consisted of attribute and method.
Now, let's start.
First, Install and run IntelliJ which can be downloaded at here or directly from the community at here. Yes, it's officially built by community. That's why it's called as community edition from the official jetbrains web and it's free.


We could use the code from my previous post.

Before we continue to the code, we should know about the access level or access modifiers in Java.
There are four access modifiers, package-private, protected, public and private.
Package-Private is the access modifier by default. It means the member in the same package can be accessed each other, but it can't be known by the subclass. It's the access modifier without defining with public, private or protected. I give the example for the attribute.
double Quiz,MidExam,LastExam
Protected is the access modifier which the member in the same package can be accessed each other and it can be known by the subclass. It means if you want to access the subclass from another class, you can extend the class of another class. I give the example for the attribute.
protected double Quiz,MidExam,LastExam
Public is the access modifier which the member can be accessed publicly or visible to all of class. I give the example for the attribute.
public double Quiz,MidExam,LastExam
Private is the access modifier which the member can be accessed only itself in the class. I give the example for the attribute.
private double Quiz,MidExam,LastExam
From the previous of my post, we modify it a little. Make your attribute private to make the value can't be directly set.

You can see what happens on the tester class. It can't access, because the class is private, even though it's in the same package.

Now, we need to make the public setter and getter.
What is setter?
Setter is the method to modify or set the value of the variable.
What is getter?
Getter is the method to get or view the value of the variable.
Modify all of it just like the code below. About this code if(x>=0 && x<=100), it's an exception or handler if the value is set lower/higher than it's supposed to be.
public void setQuiz(double x){
if(x>=0 && x<=100)
Quiz=x;
}
public double getQuiz() {
return Quiz;
}
Then, run the tester again. Don't forget to change to getQuiz and the others as well, too, to make it get your value, then return it.
Score n=new Score();
n.setQuiz(60);
System.out.println("Quiz : "+n.getQuiz());
Here is The Final Result.

Object Oriented Programming in Java with IntelliJ Part 1
Posted on Utopian.io - Rewarding Open Source Contributors


love java programming, but is not easy to execute.
Yeah, love :D
This is really captivating. and informative
Thank you.
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Thanks for approval @syedumair
Hey @dissgo I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x