I have an assignment for school that involves creating a java program that creates a basic class.

I'm getting an error missing return statement, if i try to compile.

What could be wrong here?

Recommended Answers

All 3 Replies

missing return statement means that your method expects you to return a value. for example :

int add(int x, int y) {
  return x+y;
}

if your method does not return a value its signature need to be like this:

void foo() {
// some code here
}

yeah i duno if i can post my code on here, but if someone can reply, i need to see if i'm on the right track, i wanna send them my code in a private message and if its correct?

starting to bug me and i duno what im doing wrong. thx

yeah i duno if i can post my code on here, but if someone can reply, i need to see if i'm on the right track, i wanna send them my code in a private message and if its correct?

starting to bug me and i duno what im doing wrong. thx

Yeah, you can post your code here, that's the whole idea. PMs with code are discouraged on this site. It's better to post it for everyone so everyone can see it and people with the same problem can learn from it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.