+ 2
What is meant by CLASS and PACKAGE in java?
6 Antworten
+ 4
Package os exactly the folder. If you create a new package at your workbench and go to directory you will see the folder.
When importing a package is like move the folder to their directory.
But have a good maining, you can define what classes and method can or not be acessed by package.
+ 5
Beast Incarnate yes package create directory structure internally.
You can see the example: https://javagoal.com/packages-in-java/
+ 4
A class is something which have methods and properties
And a package is a simply a namespace where make or categorize your class
so that you can group many classes with same functionality in better way
+ 4
Class, is like a blueprint for something. You write what it have, can do, your behavior.
And after you create your Object
MyClass object = new Object();
But anything, your object can be anima..
class Animal()
{
int legs;
boolean canFly;
makeSoung()
{
}
}
So, the Class Animal are defining animal.
+ 4
A package generally contains classes.
+ 2
Package is like a folder?