Usando una clase en java

Suppose I want to use a class that someone else wrote in java, do I need to get access to the source code itself or is there another way?

preguntado el 10 de marzo de 12 a las 15:03

As other said, no you do not need the source. Have you actually tried it and are having problems? Just wondering if there is another reason for your question. -

6 Respuestas

No, its not necessary to have the source code unless you need to understand the methods of the class. You can use the compiled java class that will (generalmente) be available as a jar distribution.

respondido 11 mar '12, 03:03

No, you do not need the source code, just the compiled class, which is typically distributed in jar files.

respondido 10 mar '12, 15:03

Ask them to compile it into a.jar

respondido 10 mar '12, 15:03

you'd typically have a jar file published by the author of the class you're going to use

respondido 10 mar '12, 15:03

You can get the compiled java class file and included that in your classpath. Normally it is good to have the source code with you because you can always reference if you are in doubt what actually the class methods do.

respondido 10 mar '12, 15:03

If you just want to use that class file in your programm, you don't need the source code. Yo can straight away call that class methods. In IDS like eclipse when you type dot after object name of that class , even yo can see all the methods available for outside work. But yes if you want to understand the code of that class you need source code which you can get after decompilation of class too(if source code is not available)

respondido 10 mar '12, 15:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.