+ 1

Java code

class VolumeCrayonObjet { public Static void main(String args[]) { Crayon leCrayon; leCrayon = new Crayon(50,10f); leCrayon.affiche(); System.out.println("volume="+leCrayon.volume()); } } > please any one can explaine to me this code

18th Jul 2017, 10:46 PM
Mosaab Yassir Lafrimi
1 Resposta
+ 2
A Crayon is created with 50 and 10f passed as arguments to the constructor. I can only assume the constructor is something like this: Crayon(int a, float b){} Then the affiche method is called from the created Crayon. Whatever that does. Then the volume of the Crayon that was created is printed. Whatever volume is supposed to mean. I assume it's a getter for the instance variable. Not much more information can be given with the information presented in the question. I'm assuming the Crayon class isn't something from a Java Library. But even then since idk that library, we'd need to see more code.
18th Jul 2017, 11:28 PM
Rrestoring faith
Rrestoring faith - avatar