What are the differences between classes and packages in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What are the differences between classes and packages in java

Java question

31st Jul 2018, 11:53 PM
Ibrahim Buhari
Ibrahim Buhari - avatar
2 Answers
+ 5
Say your making a board game. You might have classes for all the things that are part of making the board in one package like the start space, end space, good spaces, and bad spaces. Your second package might be all the classes involved in playing like players, dice, and money. Packages organize your classes in logical groupings.
1st Aug 2018, 12:29 AM
John Wells
John Wells - avatar
0
Java packages can be stored in compressed files called JAR files, allowing classes to download faster as a group rather than one at a time. on the other hand, a class is a programming language construct that is used to group related instance variables and methods https://www.tutorialspoint.com/java/java_packages.htm
11th Aug 2018, 10:37 AM
deepak sharma
deepak sharma - avatar