+ 2

What is meant by CLASS and PACKAGE in java?

11th Oct 2020, 10:25 PM
Krishna
Krishna - avatar
6 Réponses
+ 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.
12th Oct 2020, 2:24 AM
Marcelo Anjos
Marcelo Anjos - avatar
+ 5
Beast Incarnate yes package create directory structure internally. You can see the example: https://javagoal.com/packages-in-java/
12th Oct 2020, 4:47 PM
Raina Dhankhar
Raina Dhankhar - avatar
+ 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
12th Oct 2020, 12:30 AM
Ayush Kumar
Ayush Kumar - avatar
+ 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.
12th Oct 2020, 2:27 AM
Marcelo Anjos
Marcelo Anjos - avatar
+ 4
A package generally contains classes.
13th Oct 2020, 9:24 PM
Sonic
Sonic - avatar
+ 2
Package is like a folder?
12th Oct 2020, 12:35 AM
Krishna
Krishna - avatar