+ 2
What is classes in java
can anybody give detailed explanation of classes in java
3 Respostas
+ 2
Simply a class is a collection of related data. It was invented as a way to abstract information which is relivent to eachother so it's easier to work with.
Imagine an object (as Java is an object Oriented Language), and that object has qualities and information associated with it.
Example: A ball has a diameter, a radius and a weight.
A class can have other classes, or inherit from classes.
Example: A car has a Wheel.
You can also have abstract classes which you cannot instantiate, static classes which cannot be inherited.
There are strategies for relationships between classes, and Design Patterns you can study.
SO. There's a lot to understand about classes, and they change per object oriented language.
+ 2