Till now I have done basic concepts . from tomorrow i will try my best to dive deep into java oop
OOP IN JAVA
I'll cover oop in java in two days Where Java meets desire—object by object, method by method. This isn’t just code. It’s power written in syntax. OOP, redefined.
Bold. Elegant. Unforgettable.
there can not be constructors in interfaces
There are four types of access modifiers in java .In access modifiers we define which thing is accessible to whome .we have so much resources, in a class there are many type of information stored some of that information is sensitive like passwords that we don't want any other file to access:
1-public.
2-private.
3-protected.
4-default.
28/05/2025
this is how we create and import package
EXAMPLE OF PACKAGE:
We use scanner class to take input in java . and to use scanner class we have to write a statement at the very first line .
"import java.util.*;" after this we can use scanner class.
WHAT IS PACKAGES :
It’s better practice to write code logically. In organizations, we often work with thousands of lines of code. If our code isn’t organized, it becomes difficult for others to understand—especially for new programmers, because they also learn from the previously written code. Even for us, it can be hard to understand our own code after some time.
One way to write code in a good and logical manner is by using packages. In packages, we write related code. For example, if we talk about a website, many things work at the same time—some code handles buttons, some handles color or user interface, and some handles user data. These are three different parts of a website.
So, to develop built-in functions for these different parts, we should create packages with good structure—one package for each specific function. This helps keep things organized and easy to manage.
packages is actually merging the related items together so that order can be maintained as well as logic
A package in Java is used to group related classes. Think of it as a folder in a file directory. We use packages to avoid name conflicts, and to write a better maintainable code. Packages are divided into two categories:
Built-in Packages (packages from the Java API)
User-defined Packages (create your own packages)
Packages and access modifiers
There is a 5th type of inheritance MULTIPLE INHERITANCE which is not present in the form of classes in java but is present in c++. In java we uses interfaces to implement multiple inheritance.
28/05/2025
as if we see our previous post it wascollectively a HYBRID inheritance
28/05/2025
Hierarchical inheritance : In this post i did hirarchical inheritance TRIANGLE class is connected to SHAPE class .
EquilateralTriangle extends triangle(which is multi7level inheritance).
CIRCLE class is inherited to shape WHICH IS HIERARCHICAL INHERITANCE .
Click here to claim your Sponsored Listing.
Location
Category
Website
Address
Java
Tegal