Results 1 to 20 of 20

Thread: Hey guys,i have a question!

  1. #1
    Join Date
    Dec 2011
    Posts
    212
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Hey guys,i have a question!

    Actually im programming Java ; i have this code and i get this error:

    import java.security.PublicKey;

    Public class gastonjavaclass {
    Public void main (String [] args) {
    System.out.println("hols");
    }

    }


    invalid method declaration; return type required
    <identifier> expected
    class, interface, or enum expected

    Im using IntelliJ IDEA 11.0
    Thanks for the time guys.

  2. #2
    Join Date
    Sep 2010
    Location
    Azeroth
    Posts
    395
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    post is right section please........

    this is help with runescape simba scar , iono bot stufff but yeah i think theres a programming section down below...

    it would help keeping things orderly!!!

  3. #3
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Ma-Ma-Ma-MOVED!

  4. #4
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Gaston7eze View Post
    Actually im programming Java ; i have this code and i get this error:

    import java.security.PublicKey;

    Public class gastonjavaclass {
    Public void main (String [] args) {
    System.out.println("hols");
    }

    }


    invalid method declaration; return type required
    <identifier> expected
    class, interface, or enum expected

    Im using IntelliJ IDEA 11.0
    Thanks for the time guys.
    dont you need to return a integer for the main so the program knows if there were any errors?

    ~shut

  5. #5
    Join Date
    Dec 2011
    Posts
    212
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Shuttleu View Post
    dont you need to return a integer for the main so the program knows if there were any errors?

    ~shut
    It could be ,i don't know.Could you give me an example if you can!?Thanks.

  6. #6
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  7. #7
    Join Date
    Nov 2011
    Location
    Maryland
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    import java.security.PublicKey;
    
    public class gastonJavaClass {
    	public static void main(String[] args) {
    		System.out.println("hols");
    	}
    }
    Lowercase P's, and please learn Java standards.. lowercase first letter and then Capital for the next word's first letter.


    Quote Originally Posted by Shuttleu View Post
    Code:
    import java.security.PublicKey;
    
    public class gastonJavaClass {
     public int main (String [] args) { 
        System.out.prinln("hols");
      }
    
    }
    where it says void,change it to int

    ~shut
    It's "public static void main(String[] args)", not int.
    Last edited by eXoTiK; 01-03-2012 at 12:46 AM.

  8. #8
    Join Date
    Dec 2011
    Posts
    212
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Shuttleu View Post
    Code:
    import java.security.PublicKey;
    
    public class gastonJavaClass {
     public int main (String [] args) { 
        System.out.prinln("hols");
      }
    
    }
    where it says void,change it to int

    ~shut
    Thanks for the help,now i got this error :S


    import java.security.PublicKey;

    Public class gastonjavaclass {
    Public int main (String [] args) {
    System.out.println("Hols");
    }
    }

    class, interface, or enum expected
    <identifier> expected
    invalid method declaration; return type required

  9. #9
    Join Date
    Nov 2011
    Location
    Maryland
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I gave you the correct version, use mine.

  10. #10
    Join Date
    Dec 2011
    Posts
    212
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I don't understand what are you trying to explain.Can you explain it easier for me?I dont speak english very well as i am from Argentina.

  11. #11
    Join Date
    Nov 2011
    Location
    Maryland
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    import java.security.PublicKey;
    
    public class gastonJavaClass {
    	public static void main(String[] args) {
    		System.out.println("hols");
    	}
    }
    I fixed your standards (lowercase, uppercase, naming, spacing, etc) and when coding in Java, most is lowercase (such as the P's you left uppercase). Just use my version above and it will work.

  12. #12
    Join Date
    Dec 2011
    Posts
    212
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by eXoTiK View Post
    Code:
    import java.security.PublicKey;
    
    public class gastonJavaClass {
    	public static void main(String[] args) {
    		System.out.println("hols");
    	}
    }
    I fixed your standards (lowercase, uppercase, naming, spacing, etc) and when coding in Java, most is lowercase (such as the P's you left uppercase). Just use my version above and it will work.
    Thanks man!

    Edit:
    C:\Users\Marcelo\IdeaProjects\gaston2012\gaston201 2java\src\gastonjavacla.java
    class gastonJavaClass is public, should be declared in a file named gastonJavaClass.java
    C:\Users\Marcelo\IdeaProjects\gaston2012\gaston201 2java\src\Gaston\MainExample1.java
    cyclic inheritance involving Gaston.MainExample1
    C:\Users\Marcelo\IdeaProjects\gaston2012\gaston201 2java\src\IntegerExampleTest.java
    package junit.frameworke does not exist
    I got this errors!

  13. #13
    Join Date
    Nov 2011
    Location
    Maryland
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Rename gastonJavaClass to "gastonjavacla". Not sure about the others as those aren't related to the script you posted above.

    I'm beginning to think you shouldn't be programming at all. And besides, IntelliJ sucks tbh; Eclipse or Netbeans are much better. If you could tell me what you're trying to create, I could help you make it.
    Last edited by eXoTiK; 01-03-2012 at 01:17 AM.

  14. #14
    Join Date
    Dec 2011
    Posts
    212
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by eXoTiK View Post
    Rename gastonJavaClass to "gastonjavacla". Not sure about the others as those aren't related to the script you posted above.

    I'm beginning to think you shouldn't be programming at all. And besides, IntelliJ sucks tbh; Eclipse or Netbeans are much better. If you could tell me what you're trying to create, I could help you make it.
    Why i shouldnt be programming?We all start from a begin.

    Im trying to do the program to write in the debug box "Hells"

  15. #15
    Join Date
    Nov 2011
    Location
    Maryland
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Gaston7eze View Post
    Why i shouldnt be programming?We all start from a begin.

    Im trying to do the program to write in the debug box "Hells"
    I was just saying because you seem to need guidance for everything. When I first started, I didn't have nearly as many issues as you had and I could work through mine by myself.

  16. #16
    Join Date
    Dec 2009
    Location
    R_GetPlayerLoc;
    Posts
    2,235
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    IF you want a good place to start Java try: thenewboston.com

    To Mods: If posting that link is not allowed ill be glad to edit it.
    "Logic never changes, just the syntax" - Kyle Undefined?

    Remember, The Edit Button Is There For A Reason!!!

  17. #17
    Join Date
    Dec 2011
    Location
    Texas
    Posts
    348
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What are you trying to import

  18. #18
    Join Date
    Sep 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    actually the class name should be camel capped starting with the first letter of the first word.

  19. #19
    Join Date
    Sep 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Yago View Post
    IF you want a good place to start Java try: thenewboston.com

    To Mods: If posting that link is not allowed ill be glad to edit it.
    I second this motion. thenewboston is also on youtube as well, he's a very good teacher and he's pretty funny too, he makes it rather interesting and fun to learn, not dull and repetitive. Bucky Roberts is a smart guy. I'm learning PHP from thenewboston as we speak.

  20. #20
    Join Date
    Dec 2011
    Posts
    212
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by chandlerethan View Post
    I second this motion. thenewboston is also on youtube as well, he's a very good teacher and he's pretty funny too, he makes it rather interesting and fun to learn, not dull and repetitive. Bucky Roberts is a smart guy. I'm learning PHP from thenewboston as we speak.
    Yeah?I maybe give it a try

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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