Difference between java class and jar

2019-03-08 13:05发布

What is the difference between a java class file and a jar file?

标签: java class jar
4条回答
不美不萌又怎样
2楼-- · 2019-03-08 13:57

A JAR file has many files into it. We generally use .jar files to distribute Java applications or libraries, in the form of Java class files and associated metadata and resources (text, images, etc.). you can say JAR = Java ARchive.

All java files are compiled into class files and then we use that class file not the .java file. A class is a construct that is used as a blueprint to create instances of the class.

See Wikipedia for more information: Wikipedia for JAR and Wikipedia for class

查看更多
放荡不羁爱自由
3楼-- · 2019-03-08 14:01

A java file contains Java code. A Java file is compiled to produce a class file that can be loaded by the JVM. The contents of a class file are rather well explained here. A Jar file is an archive of otherfile, most likely class files.

查看更多
何必那么认真
4楼-- · 2019-03-08 14:05

JAR file is the compressed file format. You can store many files in a JAR file. JAR stands for the Java Archive. This file format is used to distribute a set of java classes. This file helps you to reduce the file size and collect many file in one by compressing files

a Class is explained here

查看更多
We Are One
5楼-- · 2019-03-08 14:09

A Jar file is an Zip archive containing one or multilple java class files. This makes the usage of libraries (consisting of multiple classes) more handy. Directories and Jar files are added to the classpath and available to the ClassLoader at runtime to find particular classes inside of it.

查看更多
登录 后发表回答