How come this program doesn't run?
Well.. not just this program, all my other ones.
There are no mistakes, I wrote the code as this textbook says but its not running and its giving this error (on dr java):

1 error found:
File: (no associated file) [line: (no source location)]
Error: No compiler is available.

The code looks like this:

public class TestDisk { 
  
  public static void main(String[] args) { 
    Disk saucer = new Disk(10, 0.02); 
    
    System.out.println("Disk radius: " + saucer.getRadius()); 
    System.out.println("Disk surface area: " + saucer.area()); 
    System.out.println("Disk volumn: " + saucer.volumn()); 
    
    Disk plate1 = new Disk(12, 0.05); 
    Disk plate2 = new Disk(12, 0.07); 
    if (plate1.equals(plate2)) {   
      System.out.println("objects are equal "); 
    } else { 
      System.out.println("Objects are not equal "); 
    } 
    System.out.println(plate1); 
    System.out.println(plate2); 
  }
}

I saved it as Test.Disk

The name of the file should be the name of the class in an example like this one. Save your file as TestDisk.java
Did you mean to put the '.' in between Test and Disk?

Edited 7 Years Ago by Grn Xtrm: n/a

Yea it is. accept on the top bar it says C://document and settings\HP_adminstrator\MyDocuments\TestDisk.java.. and it doesn't just say testDisk.java

Do you have the java compiler downloaded? When I first started Java I had trouble finding the compiler online (i think it was called JDK or something like that). You need this to run java code and I dont believe it comes with Java implementation environments such as Jcreator, TextPad, etc.

oh, thats probably why.... I only dled the Dr java. Ima dl the JDK then

I have dled the JDK.
Now I have Jdk and Drjava.
But now when I try to run this program there like like 14 errors.......
I don't get it..

I have dled the JDK.
Now I have Jdk and Drjava.
But now when I try to run this program there like like 14 errors.......
I don't get it..

Let us see the errors.
The class in which the Disk constructor is defined must be in the same folder/directory as the TestDisk class.
You do have a file with the Disk constructor right?... Or did you actually just copy that one part out of your book?

Edited 7 Years Ago by Grn Xtrm: n/a

Some things you may wish to consider,
"Disk", can I see source of it?
"Disk"s constructor...is it expecting an integer then a double?
if (plate1.equals(plate2))...did you programme "equals" In Disk?
instead of printing plate1 try printing the plate1.toString which you should have programmed to simplify things

any corrections of my post pm me please

Oh i only copy that one part.....
Is that why its probably not working?
I need 2 files to make this program work?

saucer is an object of TYPE Disk. Disk is a class. Remember, in java, Classes are blueprints for objects. So, yes you will need the Disk class. Place the code in the same package as class TestDisk and then if you are still having issues, post back here and we will try and help :). Also, I recommend you look at the basics of objects & classes in java:

here

oh... i see. I make another thread, its not about disk but this time I typed the code and the constructor (if thats what its called) the two files are in same pack. but it gives this error: Static Error: No static method in Circle with name 'main' accepts arguments (String[])

this is the link to my other thread: http://www.daniweb.com/forums/post1007535.html#post1007535

was with this defect, then I open the program again and there was the automatic update, therein was installed the copilador, then it worked.

claudio_1 : your post makes no sense.
first of all: the last reply here was five years ago, secondly, what 'defect' are you referring to ? well ... bit of a pointless post.

This article has been dead for over six months. Start a new discussion instead.