Results 1 to 9 of 9
  1. #1
    seal is offline Member
    Join Date
    Mar 2014
    Posts
    5
    Rep Power
    0

    Default problem with submitting solution in online judge

    when i submit a problem's solution in online judge Hust that time they show a error. That is-
    "Main.java:3: error: class GCD is public, should be declared in a file named GCD.java public class GCD {
    ^
    1 error"


    need help how to submit .

    here is my code that i submitted [Java] import java.util.Scanner; public class GCD { public static int - Pastebin.com

    thanks in advanced.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default Re: problem with submitting solution in online judge

    class GCD is public, should be declared in a file named GCD.java
    The error message explains what the problem is.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    seal is offline Member
    Join Date
    Mar 2014
    Posts
    5
    Rep Power
    0

    Default Re: problem with submitting solution in online judge

    Quote Originally Posted by Norm View Post
    The error message explains what the problem is.
    thanks for your reply..
    but i would sorry to say i can not understand the actual error . i would be helpful if you explain .

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default Re: problem with submitting solution in online judge

    If the source file contains a public class named XYZ
    then the source file needs to be named: XYZ.java (the filename the same as the class name)
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    seal is offline Member
    Join Date
    Mar 2014
    Posts
    5
    Rep Power
    0

    Default Re: problem with submitting solution in online judge

    Quote Originally Posted by Norm View Post
    If the source file contains a public class named XYZ
    then the source file needs to be named: XYZ.java (the filename the same as the class name)
    thanks again.
    but when i submit this in online judge (now for me that is Hust) how could i keep the both name as same whereas i copy and paste the code in there ?

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default Re: problem with submitting solution in online judge

    Sorry, I have no idea how to use that online site.

    Are the filename and the public class name the same?
    Last edited by Norm; 03-02-2014 at 06:28 PM.
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    seal is offline Member
    Join Date
    Mar 2014
    Posts
    5
    Rep Power
    0

    Default Re: problem with submitting solution in online judge

    Quote Originally Posted by Norm View Post
    Sorry, I have no idea how to use that online site.

    Are the filename and the public class name the same?
    yep ... they are ... i can run the code in my PC ... but problem arise when i submit the code in online judge through copy paste .

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default Re: problem with submitting solution in online judge

    Does the site have instructions on how to use it?

    Where does the site get the name of the file from?

    Try removing the public from the class definition.
    If you don't understand my response, don't ignore it, ask a question.

  9. #9
    seal is offline Member
    Join Date
    Mar 2014
    Posts
    5
    Rep Power
    0

    Default Re: problem with submitting solution in online judge

    Quote Originally Posted by Norm View Post
    Does the site have instructions on how to use it?

    Where does the site get the name of the file from?

    Try removing the public from the class definition.
    i've got the solution . the class name should be Main.
    thanks a lot .

Similar Threads

  1. Explanation of problem and/or alternative solution
    By USMCstitch in forum New To Java
    Replies: 5
    Last Post: 04-19-2011, 04:21 AM
  2. submitting to database
    By vallaru in forum Web Frameworks
    Replies: 0
    Last Post: 02-28-2011, 07:57 AM
  3. Replies: 5
    Last Post: 02-23-2011, 10:14 PM
  4. Submitting HTML forms through Java help
    By MysticalMagnet in forum New To Java
    Replies: 4
    Last Post: 11-14-2010, 02:41 AM
  5. Replies: 0
    Last Post: 02-24-2009, 03:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •