SRL Archive - Java Help and Tutorials

Hey guys,i have a question!


Gaston7eze

2012-01-02 18:55:41

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.

wantonman

2012-01-02 19:12:47

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!!!

YoHoJo

2012-01-02 19:16:14

Ma-Ma-Ma-MOVED!

Shuttleu

2012-01-02 19:28:23

From: Gaston7eze
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

Gaston7eze

2012-01-02 19:40:33

From: Shuttleu
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.

Shuttleu

2012-01-02 19:41:55

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

eXoTiK

2012-01-02 19:43:14


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.


From: Shuttleu
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.

Gaston7eze

2012-01-02 19:46:49

From: Shuttleu
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

eXoTiK

2012-01-02 19:50:21

I gave you the correct version, use mine.

Gaston7eze

2012-01-02 19:52:24

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.

eXoTiK

2012-01-02 19:57:22


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.

Gaston7eze

2012-01-02 19:58:59

From: eXoTiK

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\gaston2012java\src\gastonjavacla.java
class gastonJavaClass is public, should be declared in a file named gastonJavaClass.java
C:\Users\Marcelo\IdeaProjects\gaston2012\gaston2012java\src\Gaston\MainExample1.java
cyclic inheritance involving Gaston.MainExample1
C:\Users\Marcelo\IdeaProjects\gaston2012\gaston2012java\src\IntegerExampleTest.java
package junit.frameworke does not exist
I got this errors!

eXoTiK

2012-01-02 20:09:12

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.

Gaston7eze

2012-01-02 20:43:29

From: eXoTiK
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"

eXoTiK

2012-01-02 21:01:47

From: Gaston7eze
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.

Yago

2012-01-02 21:07:24

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.

Jhangir

2012-01-02 21:52:40

What are you trying to import

chandlerethan

2012-01-04 10:23:53

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

chandlerethan

2012-01-04 10:25:03

From: Yago
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.

Gaston7eze

2012-01-04 18:57:02

From: chandlerethan
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;)